[Python-3000] [Python-Dev] Filename as byte string in python 2.6 or 3.0?

Adam Olsen rhamph at gmail.com
Tue Oct 7 08:22:59 CEST 2008


On Mon, Oct 6, 2008 at 11:23 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> On approximately 10/6/2008 10:18 PM, came the following characters from the
> keyboard of Adam Olsen:
>> But "Unicode" on windows is invalid.  It shares all the same problems
>> UTF-8b does, but worse as a correct UTF-16 codec would forbid
>> exporting it.  We'd need to invent a UTF-16b to save it, or simulate
>> one manually.
>>
>> If the binary APIs on windows emitted raw UTF-16 bytes
>>
>> They do, for some definition of UTF-16, yes.
>>
>> then we merely
>> need to add a os.sepb equal to os.sep.encode('UTF-16') and you've got
>> your portable low-level API.  You don't need a path object.
>
> Except it isn't portable, because you can't do that on Posix.

The posix version should hardcode it as b'/'; I only meant windows to
use UTF-16.  You could perhaps use sys.getfilesystemencoding(), but
I'm unsure what it does if the encoding isn't an ascii superset (or
even if that can actually happen.)


-- 
Adam Olsen, aka Rhamphoryncus


More information about the Python-3000 mailing list