usefullness of pythons' builtin locale functions on Windows
Martin v. Loewis
martin at v.loewis.de
Wed Aug 7 03:04:26 EDT 2002
moc.q-dnan-p at p-nand-q.com (Gerson Kurz) writes:
> >>> import locale
> >>> locale.setlocale( locale.LC_ALL, "de" )
You should not pass a non-empty string to setlocale. The empty string
will set the locale according to the user's choice, which is the right
thing in most cases.
If you do want to pass a non-empty string, you must know what locale
names your operating system supports. In the case of Windows, the full
name of the locale is "german_Germany.1252". I believe you can omit
both the code page and the country.
> The documentation says: "The nl_langinfo function accepts one of the
> following keys. Most descriptions are taken from the corresponding
> description in the GNU C library".
The documentation also says
"This function is not available on all systems, and the set of
possible options might also vary across platforms."
> Do I really have to resort to import win32api? That reminds me of the
> situation with shutil (see <news:3ce4eebb.26302437 at News.CIS.DFN.DE>).
> Shouldn't these lib functions be made portable?
The functions are nearly as portable as they can be made; you should
not have to resort to the win32api.
Regards,
Martin
More information about the Python-list
mailing list