[Patches] [ python-Patches-1552880 ] Unicode Imports

SourceForge.net noreply at sourceforge.net
Fri Sep 8 23:03:12 CEST 2006

Patches item #1552880, was opened at 2006-09-05 20:11
Message generated for change (Comment added) made by loewis
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Submitted By: Kristján Valur (krisvale)
Assigned to: Nobody/Anonymous (nobody)
Summary: Unicode Imports

Initial Comment:
This patch modifies the import mechanism to fully
support unicode pathnames on Windows.  It does this by
first converting each member of sys.path to utf-8. 
strings are encoded using the current locale.

The whole of the import logic is then unchanged and
works on the utf-8 strings as though they were regular
ascii strings in the current locale.

Only when file operations are done, such as stat() and
open(), do we then convert from utf-8 back  to unicode
and use the Windows unicode APIs for the job.  This is
also done when initializing Module objects.

This approach has the benefit of being of having a low
impact on the importing logic, and is thus easy to
verify.  There is however some overhead with the

At CCP games we used this approach, backported to
python 2.3, to get unicode imports working for our
game, EVE Online, and thereby solving installation
issues in the far east.

This patch is submitted as demonstration code to the
python community.  I would like to see unicode fully
supported in 2.6.



>Comment By: Martin v. Löwis (loewis)
Date: 2006-09-08 23:03

Logged In: YES 

What is the value of the __file__ attribute of a module when
this patch is used?


You can respond by visiting: 

More information about the Patches mailing list