How to print a unicode string?

"Martin v. Löwis" martin at v.loewis.de
Fri Apr 18 20:14:02 EDT 2008


> From what I've googled, I think I need to set my locale.

Not on this operating system. On Windows, you need to change
your console. If it is a cmd.exe-style console, use chcp.
For IDLE, changing the output encoding is not supported.

If you want to output into a file, use codecs.open.

If you absolutely want to output UTF-8 to the terminal even
though the terminal will not be able to render it correctly,
use

  sys.stdout = codecs.getwriter("UTF-8")(sys.stdout)

HTH,
Martin



More information about the Python-list mailing list