Portable locale usage
gandalf at shopzeus.com
Fri Sep 9 11:39:52 CEST 2011
>>>> Why are you trying to force a specific locale to your program
>>> Because I wish to be able to correctly sort Croatian names.
>> Well, all right. If you want to sort Croatian names from a program that
>> runs on an English (or whatever) system, then you will have to check the
>> platform and use a locale that is supported by the platform. (But again,
>> this is not Python's limitation. Python doesn't know what encodings are
>> supported, in advance, and you cannot use a locale that is not supported...)
> I fully agree.
> I commented that, if a proper locale is installed,
> the following should work on any system:
> locale.setlocale(locale.LC_ALL, ('hr', locale.getpreferredencoding()))
> Currently the above does not work on Windows,
> and that is because the locale_alias for 'hr'
> is bound to 'hr_HR.ISO8859-2'.
> Check the source: .../Python-3.2.2/Lib/locale.py, line 537
> I was arguing that, on a Windows system,
> the locale_alias for 'hr' should be bound
> to 'Croatian_Croatia.1250'.
Looks like you have found a bug! :-) Why don't you post a bug report?
More information about the Python-list