codeset problems in wprintf and wcsftime

Andy Koppe andy.koppe@gmail.com
Wed Feb 24 12:52:00 GMT 2010


Corinna Vinschen:
> The advantage of having the strings available in wchar_t representation
> would be that the wcsftime and wprintf functions don't have to worry
> about charsets at all.  In contrast to the current solution which
> requires a conversion from multibyte which means, you have to *know*
> which source charset was being used when creating these strings.  Right
> now they only have information about one charset, which is the LC_CTYPE
> charset.
>
> In Glibc, as well as on Windows, the localization strings are originally
> stored in Unicode on disk, and Glibc stores the strings internally in multibyte
> and wchar_t representation.

I think removing the need for wprintf and wcsftime to convert to
wchar_t every time is a good reason for adding the wchar_t
representation. And glibc compatibility is a nice bonus, even though
mixing charsets just isn't a good idea.

(Also, good point about not wanting to add conversions from wchar_t to
multibyte to printf and strftime.)

Andy



More information about the Newlib mailing list