"Ross Ridge" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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.

<[EMAIL PROTECTED]> wrote:
Try setting the code page to 65001, and emit the UTF-8 explicitly.

Hmm... apparently that's not allowed on Windows XP:

C:\> chcp 65001
Active code page: 65001

C:\> python -c "for i in range(0x410, 0x430): print unichr(i).encode('utf-8')"
Traceback (most recent call last):
 File "<string>", line 1, in <module>
IOError: [Errno 13] Permission denied

This works though:

C:\> python -c "for i in range(0x410, 0x430): print unichr(i).encode('utf-8')" > x

C:\> type x
[a bunch of Cyrillic letters]

Hmm... "more x" doesn't work, while "copy x con" works but gives an error.
Looks like Windows XP support UTF-8 console output is a bit half-assed.

It is odd, though, that when the code page (and font) are correct, redirecting to a file and typing it work, but printing the result to the console does not
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to