unicode printing on Windows

BlueBird phil at freehackers.org
Thu Feb 9 11:46:46 CET 2012


The question is not totally related to Python but there is a strong
connection. Everytime that I try to debug some python programs under
Windows, I encounter the issue that things printed on the console
simply break the program because :
1. My windows console does not support UTF8
2. Things printed by the program on the stdout / stderr do not
necessarily use sys.getpreferredencoding() so break with UnicodeError.

Does anybody know how to fix problem 1 ? That way, I could at least
deal with programs that print UTF8 on stdout.

Regarding point 2, I must admit even when I am the author of the
program, printing debug information (in unicode) on the stdout is a
really really tricky thing. Is there a recommendation on how to do
that properly ?

Important information : I am using Python 2.5



More information about the Python-list mailing list