questions about locale and Windows

Manlio Perillo manlio_perilloNO at SPAMlibero.it
Fri Dec 23 05:12:36 EST 2005


Regards.

I have a few questions about locale handling on Windows.

The first: why getlocale() returns (None, None) when the locale is 'C'?

The second is: why this code fails?:

 >>> loc, enc = locale.getdefaultlocale()
 >>> print loc, enc
it_IT cp1252
 >>> locale.setlocale(locale.LC_ALL, (loc, enc))

Traceback (most recent call last):
   File "<pyshell#15>", line 1, in -toplevel-
     locale.setlocale(locale.LC_ALL, (loc, enc))
   File "C:\Python2.4\lib\locale.py", line 381, in setlocale
     return _setlocale(category, locale)
Error: unsupported locale setting


Fortunately
 >>> locale.setlocale(locale.LC_ALL, '')
'Italian_Italy.1252'

and
locale.setlocale(locale.LC_ALL)
'C'

works...



Thanks  Manlio Perillo



More information about the Python-list mailing list