[Python-Dev] Unicode filenames

Just van Rossum just@letterror.com
Sun, 9 Feb 2003 22:39:28 +0100


Guido van Rossum wrote:

> > Setting it seems to work wonderful. However, I'm a bit surprised
> > that os.listdir() doesn't return unicode strings. Is that because
> > it would break too much code?
> 
> I think that's shallow: the special-casing of unicode_file_names()
> only exists in the Windows branch of the code.

I've uploaded a tentative patch to posixmodule.c that makes os.listdir()
return unicode strings if Py_FileSystemDefaultEncoding is set:

  http://python.org/sf/683592

I'm not at all sure there's no danger in doing this, but I thought
perhaps an actual patch makes discussing this easier.

Just