"C" UTF-8 trouble

Andy Koppe andy.koppe@gmail.com
Tue Oct 6 15:14:00 GMT 2009

2009/10/6 Corinna Vinschen:
> The problem is what do we do?  POSIX requires that the default
> locale is "C".

Agreed, we can't change that.

> Do you actually propose to change the environment at
> process startup

Yes, except that I was thinking it would be sufficient to do this at
the start of a Cygwin process tree only, and not for every process.

> along these lines:
>  if (!getenv ("LC_ALL") && !getenv ("LC_CTYPE", && !getenv ("LANG"))
>    setenv ("LC_CTYPE", "C.UTF-8", 0);

This would do:

  setenv ("LANG", "C.UTF-8", 0);

Zero as the third parameter ensures that an existing LANG isn't
overwritten. And if LC_ALL or LC_CTYPE are set, they override LANG


More information about the Cygwin-developers mailing list