original) (raw)
(On Tue, Apr 28, 2009 at 11:00, Oleg Broytmann <phd@phd.pp.ru> wrote:
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 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.
On Tue, Apr 28, 2009 at 10:37:45AM +0200, Thomas Breuel wrote:� What is a "correct encoding"?
> Returning an error for an incorrect encoding doesn't make
> internationalization harder, it makes it easier because it makes debugging
> easier.
� 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.
Tom