Python 3.0b2 cannot map '\u12b'

Jukka Aho jukka.aho at iki.fi
Tue Sep 2 06:17:10 EDT 2008


Terry Reedy wrote:

>> If the terminal expects cp437 then displaying utf-8 might give some
>> problems.

> My screen displays whatever Windows tells the graphics card to tell
> the screen to display.  In OpenOffice, I can select a unicode font
> that displays at least everything in the BasicMultilingualPlane (BMP).

It would appear that the Windows port of Python is probably just not 
forcing the Win32 console into the Unicode mode or using the Unicode 
APIs. (If this holds true, it could be a leftover from the Windows 
95/98/ME days, I suppose...)

 <http://en.wikipedia.org/wiki/Win32_console>

As a workaround - for the time being - you might want to try something 
similar as described in the thread "Changing the (codec) error handler 
for the stdout/stderr streams in Python 3.0".

The approach described in there will not let you print characters 
outside the codepage 437 repertoaire - any such characters will still 
need to be substituted with something else - but at least this 
substitution should happen automatically; i.e. you can keep using the 
normal print() function the normal way - even for the fancier 
characters - and your program will no longer crash.

It would be nice to see proper Unicode Win32 console support in Python, 
of course, if at all possible.

-- 
znark




More information about the Python-list mailing list