Reputation:
The following Python code works on my Windows machine (Python 2.5.4), but doesn't on my Debian machine (Python 2.5.0). I'm guessing it's OS dependent.
import locale
locale.setlocale( locale.LC_ALL, 'English_United States.1252' )
I receive the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/locale.py", line 476, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
Questions:
Upvotes: 15
Views: 16459
Reputation: 86354
Look inside the locale.locale_alias
dictionary.
>>> import locale
>>> len(locale.locale_alias)
789
>>> locale.locale_alias.keys()[:5]
['ko_kr.euc', 'is_is', 'ja_jp.mscode', 'kw_gb@euro', 'yi_us.cp1255']
>>>
(In my 2.6.2 installation there are 789 locale names.)
Upvotes: 8
Reputation: 1300
It is OS dependent.
To get the list of local available you can use locale -a
in a shell
I think the local you want is something like Windows-1252
Upvotes: 22