[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accessing the environment's locale encoding settings
From: |
Ludovic Courtès |
Subject: |
Re: Accessing the environment's locale encoding settings |
Date: |
Thu, 15 Dec 2011 20:08:31 +0100 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) |
Hi,
Apologies for not answering earlier, and for making changes without
continuing this discussion. So here’s an after-the-fact reply.
Mark H Weaver <address@hidden> skribis:
> address@hidden (Ludovic Courtès) writes:
>> It’s not completely satisfying either because --locale is not in
>> 2.0.[0-3], so users who really need it will need some configury;
>> furthermore, from 2.2.x on, it will be mostly unneeded.
>>
>> Yet, a choice has to be made between this hack and the other one. :-)
>>
>> Thoughts?
>
> I like the --locale argument, except that the default (if there is no
> --locale argument) should be to either (A) call setlocale(LC_ALL, "") or
> (B) do something like the other hack, where the arguments are decoded as
> if the locale had been temporarily set according to the environment
> variables.
>
> My strong preference would be Option A.
The problem I see with changing the default to call setlocale(LC_ALL,
"") is that %default-port-encoding would no longer match the current
locale, as is currently the case. Or we’d have to change its default
value. But I thought this would be too disruptive in either case, and
thus I stick to Option B.
> If you are trying to maintain backward compatibility, keep in mind that
> for most practical purposes, Guile 1.8 acts closer to option A than the
> other options. Furthermore, Option A is the Right Thing moving forward,
> and matches what Guile 2.2 will do.
>
> If we accept only ASCII arguments by default, then _most_ Guile scripts
> will need to add the --locale argument, but only for versions after
> 2.0.3. More likely, many authors won't bother with this ugliness, and
> their scripts will be broken for non-ASCII locales.
Yes, I thought about that too, and thought it counted against Option A.
So the current situation is:
• In 2.0, one still has to call ‘setlocale’ implicitly, but
command-line arguments are converted from the locale encoding
suggested by the environment variables (commit
ed4c3739668b4b111b38555b8bc101cb74c87c1c).
• In 2.1, the ‘setlocale’ call is implicit when the ‘guile’ executable
is used (commit bb9b357e2b98cea82f844115ee5f66704bb6a1c8). The
%default-port-encoding value is still Latin-1, but presumably that
would need to be changed to the current locale encoding. Thoughts?
Nothing’s set in stone and I’m glad to revisit the situation.
Thanks,
Ludo’.