[I18n-sig] Passing unicode strings to file system calls

M.-A. Lemburg mal@lemburg.com
Wed, 17 Jul 2002 20:38:52 +0200


Martin v. Loewis wrote:
> "M.-A. Lemburg" <mal@lemburg.com> writes:
> 
> 
>>Python 2.2 tries to automagically encode Unicode into the
>>encoding used by the OS. This only works if Python can figure
>>out this encoding. AFAIK, only Windows platforms are supported.
> 
> 
> No; it works on Unix as well (if nl_langinfo(CODEPAGE) is supported);
> you need to invoke setlocale to activate this support (in particular,
> the LC_CTYPE category).

You mean: call setlocale() to set something or fetch the
encoding from it ? Setting a locale to something other than
"C" will cause quite a few semantic changes, so you should
beware...

Note there's also locale.getdefaultlocale() which work on many
platforms and returns the default locale and encoding
for the platform Python currently runs on.

BTW, running "python locale.py" prints your current settings.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/