[Python-Dev] Unicode and the Windows file system.

Jack Jansen jack@oratrix.nl
Wed, 21 Mar 2001 12:31:07 +0100


> The way I see it, to fix this we have 2 basic choices when a Unicode object
> is passed as a filename:
> * we call the Unicode versions of the CRTL.
> * we auto-encode using the "mbcs" encoding, and still call the non-Unicode
> versions of the CRTL.
> 
> The first option has a problem in that determining what Unicode support
> Windows 95/98 have may be more trouble than it is worth.  Sticking to purely
> ascii versions of the functions means that the worst thing that can happen
> is we get a regular file-system error if an mbcs encoded string is passed on
> a non-Unicode platform.
> 
> Does anyone have any objections to this scheme or see any drawbacks in it?
> If not, I'll knock up a patch...

The Mac has a very similar problem here: unless you go to the unicode APIs 
(which is pretty much impossible for stdio calls and such at the moment) you 
have to use the "current" 8-bit encoding for filenames.

Could you put your patch in such a shape that it could easily be adapted for 
other platforms? Something like PyOS_8BitFilenameFromUnicodeObject(PyObject *, 
char *, int) or so?
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm