[Python-Dev] Python-3.0, unicode, and os.environ

James Y Knight foom at fuhm.net
Fri Dec 5 15:27:37 CET 2008


On Dec 5, 2008, at 5:27 AM, Ulrich Eckhardt wrote:
> Using the byte variant is equally fubar, because e.g. on MS Windows  
> it is not
> supported, except through a very lossy roundtrip through the locale's
> codepage, limiting your functionality.


Yeah, IMO whole mess could have been avoided by keeping the filename/ 
args/environ simply *bytes*, like it really is, on unix. Then, make  
the Windows version of python use (always! not dependent upon locale!)  
utf-8 to decode the utf-8 bytestring to the UTF-16 that the Windows  
platform APIs expect (and vice versa). And never use the ASCII variant  
of the windows APIs.

This would mean that all *inputs* would succeed, but some *outputs*  
would not, on Windows. But that's not a new kind of failure: NUL has  
never been allowed in argv/environ, and filenames have all sorts of  
platform-dependent restrictions.

But unfortunately, it's too late for that solution...

James


More information about the Python-Dev mailing list