A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/089117.html below:

[Python-Dev] PEP 383 (again)

[Python-Dev] PEP 383 (again)Oleg Broytmann phd at phd.pp.ru
Tue Apr 28 11:52:23 CEST 2009
On Tue, Apr 28, 2009 at 11:32:26AM +0200, Thomas Breuel wrote:
> On Tue, Apr 28, 2009 at 11:00, Oleg Broytmann <phd at phd.pp.ru> wrote:
> >   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).

   There is no ftplib there. FTP server is ProFTPd, ftp clients of all
sort, one, e.g., an ftp client built-in into an automatic web-camera.
   I use python programs to process files after they have been uploaded.
The programs access FTP directory as a part of local filesystem.

> 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.

   That certainly wrong. But at least the approach allows python programs
to list all files in a directory - currently AFAIU os.listdir() silently
skips undecodeable filenames. And after a program gets all files it can
process it further - it can cleanup filenames (base64-encode them, e.g.),
but at least it can do something, where currently it cannot.

PS. It seems I started to argue for the PEP. Well, well...

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4