[Python-Dev] Import and unicode: part two

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Jan 20 19:43:03 CET 2011

On Thu, Jan 20, 2011 at 12:44 PM, Toshio Kuratomi <a.badger at gmail.com> wrote:
> .. My examples that you're replying to involve two "properly
> configured" OS's.  The Linux workstations are configured with a UTF-8
> locale.  The Windows OS's use wide character unicode.  The problem occurs in
> that the code that one of the parties develops (either the students or the
> professors) is developed on one of those OS's and then used on the other OS.

I re-read your posts on this thread, but could not find the examples
that you refer to.  ISTM, your hypothetical students should have no
problem as long as their professor uses proper tools to package her
code.  For example, if she uses a recent version of zip that supports
the Info-ZIP Unicode Comment Extra Field (see
http://www.pkware.com/documents/casestudies/APPNOTE.TXT) and students
use similarly up to date unzip tool, the shared code should work as
expected.  Similarly, I would be surprised if Samba server would not
be able to present a shared Linux partition that uses UTF-8 encoding
to a Windows client in a way that will make wopen() work as expected.

The problem with current Python import mechanism is that it does not
use wopen() on Windows and instead, attempts to encode Unicode module
name into a mythical single-byte filesystem encoding (locale ANSI code
page?)  and calls byte-oriented open(char *) on the result.

More information about the Python-Dev mailing list