RE: ICU default locale and setlocale

"Zartaj T. Majeed" <[email protected]>
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
I mentioned two issues.
1. the ICU default locale and uloc_get/setDefault
2. the ICU default converter and ucnv_setDefaultName

Issue #1 is related to #2 but will require a separate
resolution.

Issue #2 is the same as in bug 2777.
Referring to the order listed for the fix, I would suggest:
nl_langinfo(CODESET); /* if available */
setlocale(LC_CTYPE, NULL);
US_ASCII

nl_langinfo is supposed to return information about the current
locale so it should be tried first whenever possible.
setlocale with a NULL locale parameter will return the current
program locale which is what a library should be using.
If the current locale does not have a LC_CTYPE setting
then I think US_ASCII is probably the best bet because
the C library also defaults to "C" locale behavior.
I don't think ICU should query environment variables
a la setlocale(LC_TYPE, "")--that is best left to the
application to do at startup.

Thanks,
Zartaj

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of George Rhoten
Sent: Wednesday, July 16, 2003 1:21 PM
To: Zartaj T. Majeed
Cc: Icu
Subject: Re: ICU default locale and setlocale

I believe your request is related to this jitterbug
http://www.jtcsv.com/cgibin/icu-bugs/?findid=2777

That is scheduled to be fixed in ICU 2.8.

George Rhoten
IBM Globalization Center of Competency/ICU  San Jose, CA, USA




"Zartaj T. Majeed" <[email protected]>
Sent by: [email protected]
07/16/2003 12:31 PM


        To:     "Icu" <[email protected]>
        cc:
        Subject:        ICU default locale and setlocale



The following applies to Unix and other systems providing
setlocale.
The ICU default locale seems to not take into account setlocale
calls in a program. The default locale remains whatever was in
effect the first time the default locale was set. I would like to
have the default locale reflect the program's current locale.

Also related is the behavior of ucnv_setDefaultName. It returns
the encoding associated with the default locale if that can be
determined; if not it returns the value of the LC_CTYPE
environment variable by doing setlocale(LC_CTYPE, "").
The setlocale call should instead be setlocale(LC_CTYPE, NULL)
so that again the program's current locale is taken into account
and not the locale in effect when the program was launched.

Thanks,
Zartaj

_______________________________________________
icu mailing list
[email protected]
http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu


_______________________________________________
icu mailing list
[email protected]
http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.