Python 3 encoding question: Read a filename from stdin, subsequently open that filename

Martin v. Loewis martin at v.loewis.de
Tue Nov 30 20:47:57 CET 2010


> Does anyone know what I need to do to read filenames from stdin with
> Python 3.1 and subsequently open them, when some of those filenames
> include characters with their high bit set?

If your files on disk use file names encoded in iso-8859-1, don't set
your locale to a UTF-8 locale (as you apparently do), but set it to
a locale that actually matches the encoding that you use.

Regards,
Martin



More information about the Python-list mailing list