[Python-Dev] unicode imports

Kristján V. Jónsson kristjan at ccpgames.com
Mon Jun 19 16:39:17 CEST 2006

Wouldn´t it be possible then to emulate the unix way?  Simply encode any unicode paths to utf-8, process them as normal, and then decode them just prior to the actual windows io call?  It would make sense to just use the utf-8 encoding all the way for all platforms (since it is easy to work with), and then convert to most appropriate encoding for the platform in question right at the end, e.g. unicode for windows, mbcs for windows without unicode (win98) (which relies on the LC_LOCALE setting) and whatever 8 bit encoding is appropriate for the particular unix platform.

Of course, once there, why not do it unicode all the way up to that last point?  Unless there are platforms without wchar_t that would make sense.

At any rate, I am trying to find a coding path of least resistance here.  Regardless of the timeline or acceptance in mainstream python for this feature, it is something I will have to patch in for our application.


-----Original Message-----
From: Nick Coghlan [mailto:ncoghlan at gmail.com] 
Sent: 19. júní 2006 13:46
To: Kristján V. Jónsson
Cc: "Martin v. Löwis"; Python Dev
Subject: Re: [Python-Dev] unicode imports

Kristján V. Jónsson wrote:
> Funny that no other platforms could benefit from a unicode import path.
> Does that mean that windows will reign supreme?  Please explain.

As near as I can tell, other platforms use encoded strings with the normal
(byte-based) posix file API, so the Python interpreter and the file system simply need to agree on the encoding (typically utf-8) in order for both filesystem access and importing from non-ASCII paths to work.

More information about the Python-Dev mailing list