Subject: bug#20823: argv mangled by locale

From: Andy Wingo <[email-masked]>
Date: Fri, 24 Jun 2016 08:11:29 +0200

On Tue 16 Jun 2015 06:33, Zefram <[email-masked]> writes:

> I don't see any Scheme interface that reliably retrieves the command
> line arguments without locale decoding.
[...]
> The actual data passed between processes is an octet string, and
> there really needs to be some reliable way to access that octet string.
> My comments about resolution in bug#20822 "environment mangled by locale"
> mostly apply here too, with a slight change: it seems necessary to store
> the original octet strings and decode at the time program-arguments is
> called.  With that change, the decoding can be responsive to setlocale
> (and in particular can reliably use ISO-8859-1 in the absence of
> setlocale).

Proposal: scm_i_set_boot_program_arguments just copies the bytes, and
scm_program_arguments decodes them.  I don't know whether to save the
locale that was current at program start and use that locale to decode
the arguments, or default the current locale, or what.  I also don't
know whether to supply an optional "encoding" argument, and use that
encoding to decode the command line arguments.  Thoughts, Mark and
Ludovic?

Andy