[Python-3000] Unicode strings, identifiers, and import

Guido van Rossum guido at python.org
Fri May 18 01:10:25 CEST 2007

On 5/17/07, Giovanni Bajo <rasky at develer.com> wrote:
> On 13/05/2007 21.31, Guido van Rossum wrote:
> > The answer to all of this is the filesystem encoding, which is already
> > supported. Doesn't appear particularly difficult to me.
> sys.getfilesystemencoding() is None on most Linux computers I have access to.
> How is the problem solved there?

i suppose on such systems filenames are binary strings (except for '/'
and '\0') and defaulting to utf8 would work just fine.

> In fact, I have a question about this. Can anybody show me a valid
> multi-platform Python code snippet that, given a filename as *unicode* string,
> create a file with that name, possibly adjusting the name so to ignore an
> encoding problem (so that the function *always* succeed)?
> def dump_to_file(unicode_filename):
>      ...
> I attempted this a couple of times without being satisfied at all by the
> solutions.

Why does it have to be cross-platform? The mapping from module names
to the filesystem is considered platform specific.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-3000 mailing list