How to print a unicode string?

Benjamin musiccomposition at gmail.com
Fri Apr 18 22:44:07 EDT 2008


On Apr 18, 7:14 pm, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> > 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)
And in Py3k?
>
> HTH,
> Martin




More information about the Python-list mailing list