This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] Read locale settings from environment
On Feb 25 14:06, Jeff Johnston wrote:
> Corinna Vinschen wrote:
>> Apart from that, would it be ok to change setlocale() and subsequent
>> functions using __lc_ctype (e.g. mbtowc_r, wctomb_r, iswXXX) so that all
>> POSIX compliant LC_XXX environment variable settings are taken? The
>> currently accepted locales
>>
>> C[-codeset]
>>
>> are non-POSIX. The POSIX variant is
>>
>> [language[_territory][.codeset][@modifier]]
>>
>> Of course we should keep recognizing the C[-codeset] for backward
>> compatibility but I think we should not stick to them.
>>
>> Actually all the related functions only rely on the charset part of the
>> setting, not the actual language. So, what we could do is to split away
>> the charset part along the lines of what is already done in the
>> LC_MESSAGES part of the code and only check for that in the subsequent
>> functions. Instead of checking against __lc_ctype these functions could
>> check for, say, __lc_charset. The LC_CTYPE setting could then reflect
>> the real setting of the environment.
>> [...]
>> Actually the __lc_charset could be a single character like I for ISO,
>> U for UTF, E for EUCJP, etc, to simplify the checks in mbtowc_r and the
>> others.
>>
> Ok. I think the charset should be full instead of single character.
Cool. Expect a new patch within this week.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat