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

Martin v. Loewis martin@v.loewis.de
17 Jul 2002 20:54:07 +0200


"M.-A. Lemburg" <mal@lemburg.com> writes:

> 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...

Indeed. However, setting the locale may be the only way to find out
what the locale's encoding is.

> Note there's also locale.getdefaultlocale()

That is broken beyond repair, and should not be used for anything. It
can't possibly work.

> which work on many platforms and returns the default locale and
> encoding for the platform Python currently runs on.

In particular when it comes to the locale's encoding, it has no chance
to work correctly, except on Windows.

Regards,
Martin