How to emit UTF-8 from console mode?

Siegfried Heintze siegfried at heintze.com
Wed Oct 1 11:17:15 EDT 2008


>Make sure you are using the Lucida Console font for the cmd.exe window and
>type the commands:
>
>chcp 1251
>python -c "print ''.join(unichr(i) for i in range(0x410,0x431))"
>
>Output:
>
>?????????????????????????????????
>
Wowa! I was not aware of that chcp command! Thanks! How could I do that 
"chcp 1251" programatically?

The code was a little confusing because those two apostrophes look like a 
double quote!

But what are we doing here? Can you convince me that we are emitting UTF-8? 
I need UTF-8 because I need to experiment with some OS function calls that 
give me UTF-16 and I need to emit UTF-16 or UTF-8.

I think part of the problem is that Lucida Console is not as capable as 
"Arial Unicode MS" or the fonts used by urxvt-X.

Thanks,
Siegfried





More information about the Python-list mailing list