Earlier reset to "C" locale?

Corinna Vinschen corinna-cygwin@cygwin.com
Thu May 5 07:32:00 GMT 2011


On May  5 06:49, Andy Koppe wrote:
> The reset to the "C" locale for LC_CTYPE currently is done just before
> main() is invoked at the end of dll_crt0_1(). I think it would be
> better do this a bit earlier, just before
> 'cygwin_finished_initializing = true;', so that application code
> invoked via dlls.init() or the premain mechanism starts in the correct
> locale too.

I guess that depends on the definition of "the correct locale".

The initial_setlocale sets the locale to the default locale or to what's
defined in the environment.  That's what a locale-aware application will
use as well, as soon as it calls setlocale(LC_ALL, "").  So what you get
in premain and dlls.init is the locale you'll use in the application.  A
non-locale aware application is usually supposed to use ASCII only and
all supported charsets are ASCII compatible anyway, so a non locale-aware
application shouldn't see much of a difference.

What problem are you trying to fix?

> Also, it looks like programs that dynamically load the
> Cygwin DLL currently miss out on the reset.

Indeed, thanks for catching.  I fixed that in CVS.


Corinna

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



More information about the Cygwin-developers mailing list