This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

nl_langinfo(CODESET) question


Hi!

If setlocale does not find locale with the requested charset, then it just
uses the charset stored in the locale, eventhough libc is able to
transliterate.
I'm wondering whether
setlocale (LC_ALL, "cs_CZ.UTF-8");
shouldn't result in nl_langinfo(CODESET) == "UTF-8" as opposed to
"ISO-8859-2" even if the installed locale is latin2 only.
I know I can use $OUTPUT_CHARSET, am just wondering what's the proper
behaviour of setlocale in this case.
I've tried this on Solaris and if I specify a codeset that is not installed
for a selected locale, nl_langinfo(CODESET) returns "646" as opposed to e.g.
"ISO8859-2" which it returns otherwise.

Or do all programs which wonder about the character set used have to:
charset = getenv("OUTPUT_CHARSET"); if (!charset) charset = nl_langinfo(CODESET);
?

	Jakub


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