unable to print Unicode characters in Python 3

"Martin v. Löwis" martin at v.loewis.de
Tue Jan 27 13:56:03 EST 2009


> #include "stdio.h"
> int main(int argc, char **argv) {
>     printf("<\xc2\x80>\n");
>     }
> 
> compiled with mingw32 (gcc (GCC) 3.4.5 (mingw-vista special r3))
> and using "Lucida Console" font:
> 
> After CHCP 1252, this prints < A-circumflex Euro >, as expected.
> After CHCP 65001, it prints < hollow-square >.

This is not surprising: this character is U+0080, which is a control
character. Try \xe2\x82\xac instead.

Regards,
Martin



More information about the Python-list mailing list