guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix locale string reading


From: Mark H Weaver
Subject: Re: [PATCH] fix locale string reading
Date: Fri, 11 Nov 2011 18:39:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

address@hidden (Ludovic Courtès) writes:
> Nala Ginrut <address@hidden> skribis:
>> +  setlocale (LC_ALL, "");
>
> Currently, like in C, it’s the programmer’s responsibility to install
> the locale with such a call, and none of Guile’s business.

Unfortunately, I don't see a way for the user to call setlocale before a
Guile script converts the command-line arguments to Scheme strings, at
least not without providing their own `main' function in C.

It wouldn't be too hard to postpone the conversion until the first time
(command-line) or (program-arguments) is called.  That would change the
semantics somewhat, e.g. if the program modifies the argv[] array before
the first call to (command-line), but it might still be a worthwhile
change.

However, what should we do about scripts that use `-e'?
For example:

     #!/usr/local/bin/guile \
     -e main -s
     !#

     (define (main args)
       (display args)
       (newline))

I think we should consider decoding the command-line arguments using the
locale specified by the environment variables, at least in cases like
this where there's no way for the user to call setlocale before the
conversion happens.

     Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]