Displaying Unicode on the console (Windows)

Paul Moore gustav at morpheus.demon.co.uk
Wed Apr 16 17:30:13 EDT 2003


Ben Hutchings <do-not-spam-ben.hutchings at businesswebsoftware.com> writes:

> In article <ptnosvmm.fsf at morpheus.demon.co.uk>, Paul Moore wrote:
> <snip> 
>> PS Is there any way of forcing the Windows 2000/XP console to display
>>    Unicode in any form (UTF-8, maybe) rather than having to deal with
>>    code pages???
>
> UTF-8 is code page 65001.

Thanks. I didn't know that.

> Strangely, though, I get 'permission denied' when I run "chcp 65001" and
> then try to print a UTF-8-encoded Euro sign.  I don't know what could be
> going wrong there.

Someone followed up to this on python-dev. There seems to be some
level of extreme oddness with the Windows console running in UTF-8
mode.

C:\Data
>chcp 65001
Active code page: 65001

C:\Data
>python -c "print u'h\xf2l\xe1'.encode('utf-8')"
hòlá
Traceback (most recent call last):
  File "<string>", line 1, in ?
IOError: [Errno 2] No such file or directory

Using TYPE in CMD.EXE to type a file containing UTF-8 using codepage
65001 seems to work. But in 4NT.EXE it doesn't...

Sigh....

Paul.
-- 
This signature intentionally left blank




More information about the Python-list mailing list