Unicode issue on Windows cmd line

"Martin v. Löwis" martin at v.loewis.de
Wed Feb 11 18:30:07 EST 2009


> Thanks, I ended up using encode('iso-8859-15', "replace")
> Perhaps more up to date than cp1252...??
> 
> It still didn't print correctly, but it did write correctly, which was
> my main problem.

If you encode as iso-8859-15, but this is not what your terminal
expects, it certainly won't print correctly. To get correct printing,
the output encoding must be the same as the terminal encoding. If the
terminal encoding is not up to date (as you consider cp1252), then
the output encoding should not be up to date, either.

If you want a modern encoding that supports all of Unicode, and you
don't care whether the output is legible, use UTF-8.

Regards,
Martin



More information about the Python-list mailing list