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

SourceForge.net noreply at sourceforge.net
Sat Sep 9 13:38:19 CEST 2006


Patches item #1552880, was opened at 2006-09-05 18:11
Message generated for change (Comment added) made by krisvale
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1552880&group_id=5470

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

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.

Cheers,
Kristján

----------------------------------------------------------------------

>Comment By: Kristján Valur (krisvale)
Date: 2006-09-09 11:38

Message:
Logged In: YES 
user_id=1262199

>From the top of my head, it is now unicode.  I consider
trying to convert it back to the default encoding but
decided not to to keep the patch brief.  

----------------------------------------------------------------------

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

Message:
Logged In: YES 
user_id=21627

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

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1552880&group_id=5470


More information about the Patches mailing list