[Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

"Martin v. Löwis" martin at v.loewis.de
Wed Oct 1 07:21:44 CEST 2008


> Sorry, maybe I'm just being thick here, but I don't understand how that 
> is possible. On the physical disk, each Windows file name must be 
> represented by a byte string, yes? So how is it possible that there are 
> Windows files with names that can't be represented as a byte string? 
> What have I missed?

That we are not really free to choose the byte representation when
choosing byte strings. Microsoft has defined how char* (i.e. byte
strings) are to be interpreted when interpreting them as byte strings,
namely in the ANSI code page. That code page is not capable of
representing all file names.

We could, for example, use the same representation as is used on disk.
However,
a) there is no API to find out what that representation is, and
b) it is not null-byte free, a property often desired for file names,
   and
c) because it contains null bytes, it won't be easy to display such
   file names on stdout, or in a GUI window.

Regards,
Martin


More information about the Python-Dev mailing list