[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Maybe we don't have a name controversy after all

On Fri, Oct 27, 2000 at 08:48:37PM +0800, thhsieh@linux.org.tw wrote:
> If a program needs to take the currect locale name for specific reactions
> (for example, read different configuration file), then the so-called
> "official locale name" becomes important. Even it use "setlocale()" to
> get the locale name and use "nl_langinfo()" to get the encoding name,
> however the combination of them will not always result to the same string.
> For example, in current glibc-2.2 we will get "zh_TW" + "big5", but in
> other platform it might be "zh_TW.big5" + "big5" or other kinds. So, how
> to write a "portable" program to overcome this situation?

Hello Hsieh,

Here is my suggestion. Have a predefined internal (or call it "official")
locale name for each supported locale. At runtime construct the locale
name as following: get language_territory part from "setlocale", this part
is pretty much standardized; get codeset part from "nl_langinfo" and normalize
it as you will see a wide variation. Bruno Haible's libcharset does just that
so it could be a help, at least a reference (I forgot his site, you could do
a search).



Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

| This message was re-posted from debian-chinese-gb@lists.debian.org
| and converted from gb2312 to big5 by an automatic gateway.

Reply to: