<div class="gmail_quote">On Tue, Apr 28, 2009 at 11:00, Oleg Broytmann <span dir="ltr">&lt;<a href="mailto:phd@phd.pp.ru">phd@phd.pp.ru</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im">On Tue, Apr 28, 2009 at 10:37:45AM +0200, Thomas Breuel wrote:<br>
&gt; Returning an error for an incorrect encoding doesn&#39;t make<br>
&gt; internationalization harder, it makes it easier because it makes debugging<br>
&gt; easier.<br>
<br>
</div>   What is a &quot;correct encoding&quot;?<br>
<br>
   I have an FTP server to which clients with different local encodings<br>
are connecting. FTP protocol doesn&#39;t have a notion of encoding so filenames<br>
on the filesystem are in koi8-r, cp1251 and utf-8 encodings - all in one<br>
directory! What should os.listdir() return for that directory? What is a<br>
correct encoding for that directory?!</blockquote><div><br>I don&#39;t know what it should do (ftplib needs to worry about that). I do know what it shouldn&#39;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&#39;s wrong.<br>

<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
  If any program starts to raise errors Python becomes completely unusable<br>
for me! But is there anything I can debug here?</blockquote><div><br>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&#39;t allow the byte sequences that the utf-8b encodes.<br>

</div></div><br>Tom<br>