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

Stephen J. Turnbull stephen at xemacs.org
Tue Sep 30 03:13:11 CEST 2008


Greg Ewing writes:
 > Ulrich Eckhardt wrote:
 > 
 > > AFAIK, OS X guarantees UTF-8 for filesystem encodings. So the OS
 > > also provides Unicode filenames and how it deals with broken or
 > > legacy media is left up to the OS.
 > 
 > Does this mean that the OS always returns valid utf-8 strings
 > from filesystem calls, even if the media is broken or legacy?

No, this means Ulrich is wrong.  NFD-normalized UTF-8 is more or less
enforced by the default filesystem, but Mac OS X up to 10.4 at least
also supports the FreeBSD filesystems, and some of those can have any
encoding you like or none at all (ie, KOI8-R and Shift JIS in the same
directory is possible).

If you have a Mac it's easy enough to test by creating a disk image
with a non-default file system.


More information about the Python-Dev mailing list