This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
normalize_codeset
- To: libc-alpha at sourceware dot cygnus dot com
- Subject: normalize_codeset
- From: Bruno Haible <haible at ilog dot fr>
- Date: Fri, 4 Aug 2000 23:59:19 +0200 (CEST)
- References: <14730.60283.163051.344545@honolulu.ilog.fr><m3aeeszrxb.fsf@otr.mynet.cygnus.com>
What's the purpose of the normalize_codeset done by localedef?
Is it to permit that users enter the locale in lowercase and possibly
without dashes?
Then why is it *not* done if a full pathname for the locale is given?
This has the consequence that the ru_RU.KOI8-R locale (installed by
"make localedata/install-locales") is really called ru_RU.KOI8-R.
I noticed that it causes unnecessary system calls when a program calls
setlocale(LC_ALL,""). For each of the LC_CTYPE, LC_COLLATE etc. facets
strace shows three system calls
open ("/usr/lib/locale/de_DE.UTF-8/<facet>") -> -1 / ENOENT
open ("/usr/lib/locale/de_DE.UTF-8/<facet>") -> -1 / ENOENT
open ("/usr/lib/locale/de_DE.utf8/<facet>") -> fd, success
Without normalize_codeset, only one system call would be needed.
Ulrich Drepper wrote on linux-utf8:
> > - Recommend to call localedef with a full pathname argument, otherwise
> > it creates a locale which doesn't work with XFree86 4.0.1.
>
> This is wrong from the libc side. When not called with a complete
> path the names are normalized which is essential to allow all the
> different spellings of the locale names people are using. It's none
> of XFree's business to look at these files.
XFree86 doesn't look at these files. It looks at the return value of
setlocale(LC_CTYPE,NULL) and uses the resulting string
1) as an index in its own database of XLC_LOCALE files,
2) to determine whether it's an UTF-8 locale.
For 2) there is a better way: nl_langinfo(CODESET). I'll implement it
in XFree86 when I find time.
But 1) is a legitimate use. The normalize_codeset done by localedef
will force me to duplicate all the UTF-8 entries in X11's
locale.alias file.
Bruno