"C" character set (again)

Thomas Wolff towo@towo.net
Fri Jan 8 11:12:00 GMT 2010


Andy Koppe wrote:
> There's an important distinction here between the C locale and the
> defaut locale. The C locale is what you get if you don't call
> setlocale at all, whereas the default locale is what you get if you
> call setlocale(LC_FOO, "") and the relevant environment variables are
> all unset or empty.
>
> The default locale uses UTF-8, and I most certainly agree that this
> should stay as is. The charset of the filesystem and the console are
> both controlled by the default locale (unless overridden in the
> environment). They are independent of the C locale's charset or
> whether an application calls setlocale.
>
> No, this is about the C locale only. Lots of people and programs make
> assumptions about the C locale which may not be valid according to
> POSIX, but which nevertheless hold true for Linux and most (if not
> all) other Unices, including Cygwin 1.5. The most important assumption
> is that the C locale is 8-bit clean.
>   
And byte-transparent, right?
Which gets me back to this printf issue; actually your point here seems 
to approve my arguments there, if only I had explicitly restricted them 
to the C locale.
Could you agree that functions like sprintf should handle their char * 
arguments byte-transparently if acting in the C locale?

Thomas



More information about the Cygwin-developers mailing list