locale initialization issue

Corinna Vinschen corinna-cygwin@cygwin.com
Wed May 4 08:57:00 GMT 2011

On May  4 07:04, Andy Koppe wrote:
> Hi,
> I stumbled across an issues with locale initialization when the "C"
> locale is specified in the environment.
> [...]
> The attached small patch addresses this by starting with the LC_CTYPE
> locale set to "C.UTF-8"  and lc_ctype_charset set accordingly too.
> This means that setting the "C" locale is recognised as a change and
> that the conversion function pointers are updated accordingly. It also
> has the happy side effect that the setlocale call from
> initial_setlocale() will be short-circuited if the default "C.UTF-8"
> locale has not been overridden in the environment.
> Additionally, I think it's time to drop the "temporarily" #if 0'd code
> for making UTF-8 the charset for the "C" locale.
> It's a newlib patch, but it's entirely Cygwin-specific, so it seemed
> more appropriate to send it here.
> 	* libc/locale/locale.c [__CYGWIN__]
> 	(current_categories, lc_ctype_charset): Start with the LC_CTYPE locale
> 	set to "C.UTF-8", to match initial __wctomb and __mbtowc settings.
> 	(lc_message_charset, loadlocale): Settle on ASCII as the "C" charset.

Thanks, applied with a slightly different ChangeLog entry.

Please send newlib patches to the newlib list, not to cygwin-patches.
It's the better place for bookkeeping of newlib stuff, even if it
only affects Cygwin.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list