Some information about locale (was Re: [Python-Dev] repr vs. str and locales again)

Peter Funk pf@artcom-gmbh.de
Mon, 22 May 2000 08:18:22 +0200 (MEST)


Guido van Rossum:
[...]
> The one objection could be that the locale may be obsolescent -- but
> I've only heard /F vent an opinion about that; personally, I doubt
> that we will be able to remove the locale any time soon, even if we
> invent a better way.  

AFAIK locale and friends conform to POSIX.1.  Calling this obsolescent...
hmmm... may offend a *LOT* of people.  Try this on comp.os.linux.advocacy ;-)

Although I understand Barrys and Pings objections against a global state,
it used to work very well:  On a typical single user Linux system the
user chooses his locale during the first stages of system setup and
never has to think about it again.  On multi user systems the locale
of individual accounts may be customized using several environment
variables, which can overide the default locale of the system.

> Plus, I think that "better way" should address
> this issue anyway.  If the locale eventually disappears, the feature
> automatically disappears with it, because you *have* to make a
> locale.setlocale() call before the behavior of repr() changes.

The last sentence is at least not the whole truth.

On POSIX systems there are a several environment variables used to
control the default locale settings for a users session.  For example
on my SuSE Linux system currently running in the german locale the
environment variable LC_CTYPE=de_DE is automatically set by a file 
/etc/profile during login, which causes automatically the C-library 
function toupper('') to return an '' ---you should see
a lower case a-umlaut as argument and an upper case umlaut as return
value--- without having all applications to call 'setlocale' explicitly.

So this simply works well as intended without having to add calls
to 'setlocale' to all application program using this C-library functions.

Regards, Peter.