Problem with national characters

Leif B. Kristensen abuse at solumslekt.org
Sat Apr 9 06:03:44 EDT 2005


"Martin v. Löwis" skrev:

> You need to do locale.setlocale(locale.LC_ALL, "") to get
> locale-specific upper-casing.

That makes a lot of sense. Thank you.

>>> 'før'.upper()
'F\xf8R'
>>> 'FØR'
'F\xd8R'
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'no_NO'
>>> 'før'.upper()
'F\xd8R'
>>> 'FØR'
'F\xd8R'

I must make a note of the LC_ALL variable in the installation README. 
I for one have been running Gentoo Linux for two years without ever
setting the locale, - but now I've finally gotten around to write my
own /etc/env.d/02locale file :-)

> Notice that things are more difficult in the Windows terminal window,
> as this uses an encoding different from the one that the system's
> locale functions expect.

The real input will come from a GUI or a browser interface, so the
Windows terminal problem isn't really an issue.
-- 
Leif Biberg Kristensen
http://solumslekt.org/



More information about the Python-list mailing list