This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: codeset problems in wprintf and wcsftime


On Feb 20 16:42, Andy Koppe wrote:
> > another alternative to the solutions you outlined
> > might be to store those strings as wchar versions only, to be used
> > directly in wprintf and converted to the LC_CTYPE character set when
> > needed in printf. That way, the user would always get readable output.
> >
> >> - Store the charset not only for LC_CTYPE, but for each localization
> >> ?category, and provide a function to request the charset.
> >> ?This also requires to store the associated multibyte to widechar
> >> ?conversion functions, obviously, and to call the correct functions
> >> ?from wprintf and wcftime.
> >>
> >> - Redefine the locale data structs so that they contain multibyte and
> >> ?widechar representations of all strings. ?Use the multibyte strings
> >> ?in the multibyte functions, the widechar strings in the widechar
> >> ?functions.
> 
> Actually, there's a fourth alternative: do nothing.
> 
> >From http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html:
> "If different character sets are used by the locale categories, the
> results achieved by an application utilizing these categories are
> undefined."
> 
> (So why did they even allow different charsets to be specified for
> different categories!?)

History?

Nevertheless, there are ways to do it better than that.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]