[Python-Dev] Unicode strings as filenames

M.-A. Lemburg mal@lemburg.com
Fri, 04 Jan 2002 12:20:12 +0100


Neil Hodgson wrote:
> 
> Marc-Andre Lemburg:
> 
> > The only option I see to make this situation less painful is
> > to write a filename subsystem which implements two generic
> > APIs:
> >
> > 1. file open using strings and Unicode
> >
> > 2. file listing using either Unicode or strings with a predefined
> >    encoding in the output list
> 
>    I started work on this in C++ for my SciTE editor a couple of months ago
> but the design started to include stuff like 'are these two paths pointing
> at one file', converting between OpenVMS and Unix paths, and handling URLs
> (at least using ftp and http). My brain threatened to explode if it got any
> more complex so it got moved to the 'future niceness' pile.

I believe that we could do well with the following assumptions:
a) strings passed to open() use whatever encoding is needed by the 
   file system
b) Unicode passed to open() are converted to whatever the file system
   needs by then open() API.

This doesn't cover all the possibilities, but goes a long way. Joining
paths between file systems should really be left to the os.path
APIs.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/