[Python-Dev] PEP 383 (again)

Thomas Breuel tmbdev at gmail.com
Tue Apr 28 11:32:26 CEST 2009

On Tue, Apr 28, 2009 at 11:00, Oleg Broytmann <phd at phd.pp.ru> wrote:

> On Tue, Apr 28, 2009 at 10:37:45AM +0200, Thomas Breuel wrote:
> > Returning an error for an incorrect encoding doesn't make
> > internationalization harder, it makes it easier because it makes
> debugging
> > easier.
>    What is a "correct encoding"?
>   I have an FTP server to which clients with different local encodings
> are connecting. FTP protocol doesn't have a notion of encoding so filenames
> on the filesystem are in koi8-r, cp1251 and utf-8 encodings - all in one
> directory! What should os.listdir() return for that directory? What is a
> correct encoding for that directory?!

I don't know what it should do (ftplib needs to worry about that). I do know
what it shouldn't do, however: it sould not return a utf-8b string which,
when used to create a file, will create a file reproducing the byte sequence
of the remote machine; that's wrong.

  If any program starts to raise errors Python becomes completely unusable
> for me! But is there anything I can debug here?

If we follow PEP 383, you will get lots of errors anyway because those
strings, when encoded in utf-8b, will result in an error when you try to
write them on a Windows file system or any other system that doesn't allow
the byte sequences that the utf-8b encodes.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090428/246a37be/attachment.htm>

More information about the Python-Dev mailing list