unable to print Unicode characters in Python 3

Jean-Paul Calderone exarkun at divmod.com
Mon Jan 26 22:38:07 CET 2009


On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm <jef.mangelschots at gmail.com> wrote:
>>As Benjamin Kaplin said, Windows terminals use the old cp1252 character
>>set, which cannot display the euro sign. You'll either have to run it in
>> something more modern like the cygwin rxvt terminal, or output some
>>other way, such as through a GUI.
>
>>With the standard console, I get the same.  But with IDLE, using the
>>same Python build but through a different interface
>
>>Scream at Microsoft or try to find or encourage a console
>>replacement that Python could use.  In the meanwhile, use IDLE.  Not
>>perfect for Unicode, but better.
>
>
>So, if I understand it correctly, it should work as long as you run
>your Python code on something that can actually print the Unicode
>character.
>Apparently, the Windows command line can not.
>
>I mainly program command line tools to be used by Windows users. So I
>guess I am screwed.
>
>Other than converting my tools to have a graphic interface, is there
>any other solution, other than give Bill Gates a call and bring his
>command line up to the 21st century ?

cp1252 can represent the euro sign (<http://en.wikipedia.org/wiki/Windows-1252>).  Apparently the chcp command can be used to change the code page
active in the console (<http://technet.microsoft.com/en-us/library/bb490874.aspx>).  I've never tried this myself, though.

Jean-Paul



More information about the Python-list mailing list