[Python-Dev] GSoC: Replace MS Windows Console with Unicode UI

Glenn Linderman v+python at g.nevcal.com
Mon Mar 23 22:29:03 CET 2009

On approximately 3/23/2009 12:12 PM, came the following characters from 
the keyboard of Terry Reedy:
> Glenn Linderman wrote:
>> One can set CMD into Unicode mode (chcp 65001)... not sure how Python 
>> reacts to that either.  But even then...
> I tried that and others have reported doing so on python-list but no one 
> has gotten that to work.


(python 3)

import ctypes
x = k.SetConsoleOutputCP(65001)
if x!= 1:
     print("x was ", x )
     exit( 1 )
print (''.join(chr(i) for i in range(0x410, 0x430)).encode('utf-8'))

produces a nice b'\xd0\x90\d0\x91....' stream of hex representations of 
UTF-8 encoded Unicode characters...

The only thing that seems to be missing is that Python won't emit them 
to the screen that way.

So surely some python-dev that is smarter than me, could provide that 
magic incantation.  Will go search, but that isn't in my current 
knowledge banks.

Glenn -- http://nevcal.com/
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

More information about the Python-Dev mailing list