[Python-Dev] Unicode strings as filenames
Neil Hodgson
nhodgson@bigpond.net.au
Wed, 9 Jan 2002 10:35:29 +1100
Martin:
> > If true, the underlying system supports file names containing most
> > Unicode characters and any valid file name may be passed to open as a
> > Unicode string.
>
> So what is the value of exposing this to Python? It seems to be
> Windows-specific, so I doubt it should be generalized.
It differentiates between those systems where open decodes Unicode file
names into a particular locale (possibly losing information) and those
systems that preserve Unicode file names. The set of systems where this is
true could change in the future. A sufficiently motivated Windows 9x user
could make it work there, possibly by looking for the long names in the
directory data and converting them to short names.
When this is false, client code may be prepared to offer a more
reasonable error message indicating the the locale may be set incorrectly or
even try multiple locales in order to open a file. Mmm, there is a Japanese
character in that file name so I'll try temporarily changing the locale to
Japanese to open the file.
Neil