How to emit Cyrillic and Chinese via unicode from console mode?

Gertjan Klein gklein at
Sun Sep 14 12:51:35 CEST 2008

rs387 wrote:

>sys.stdout = encodings.utf_8.StreamWriter(sys.stdout)


>If redirected to file, all is well, this prints everything properly in
>UTF-8. If ran on the console, this also prints everything correctly,
>but then throws a mysterious exception:

Interesting. On my system (Windows XP) the console codepage does not
change, and hence the characters don't print properly (I get some of the
CP437 line drawing characters, for example). I have never been able to
convince windows to assume/support UTF-8 encoding in the console,
programatically or otherwise. :(


Gertjan Klein <gklein at>

More information about the Python-list mailing list