Another Windows zipfile encoding problem, with patch

Martin v. Löwis martin at v.loewis.de
Mon May 5 17:31:36 EDT 2003


Patrick Useldinger <uselpa at myrealbox.com> writes:

> Martin v. Löwis wrote:
> > (*) Actually, it uses the platform native encoding. So it supports
> > other code pages as well, but you can't exchange zipfiles across
> > Windows installations with different code pages correctly.
> 
> Is there a way to find out in Python what the platform encoding is?

In Python 2.3, there locale.getpreferredencoding(). In Python 2.2,
there is locale.getdefaultlocale()[1], but this is sometimes incorrect
(though never on Windows). You can also refer to the platform encoding
on Windows as "mbcs" in all circumstances - this is *precisely* what
the system uses to report file names to Python.

Regards,
Martin





More information about the Python-list mailing list