[Python-Dev] Unicode strings as filenames
Jack Jansen
jack@oratrix.nl
Fri, 04 Jan 2002 13:47:45 +0100
Off on a slight tangent:
On Mac OS X the default 8-bit encoding is UTF8. os.listdir() handles
this fine and so does open(). The OS does all the hard work for you:
it knows that some mounted disks may be in other 8-bit encodings (such
as MacRoman or MacJapanese for old mac disks, or probably latin-1 for NFS
filesystems, or god-knows-what for SMB mounted disks) and handles the
conversion.
But in Python (unix-Python we're talking here, not MacPython),
unicode(filename) fails, because site.encoding is "ascii".
Would it be safe to set site.encoding to utf8 on Mac OS X by default?
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm