[Python-Dev] Python dies upon printing UNICODE using UTF-8
Moore, Paul
Paul.Moore@atosorigin.com
Wed, 16 Apr 2003 15:53:24 +0100
From: Duncan Booth [mailto:duncan@rcp.co.uk]
> I think its a problem with windows, or with the C runtime rather than=20
> Python. The line editing is handled by the system and is obviously =
screwy.=20
> Python is interpreting what you entered as signalling end of file. =
Call=20
> raw_input and type your text there and you will get an EOFError.
Too right something's screwy. But it's not just in the interactive
interpreter. It goes wrong when run from a file, with no non-ascii
characters in the script, as well.
See the attached transcript.
I don't doubt that it's some sort of Windows/CRT problem, but maybe
it's fixable within Python...?
Paul
--- session transcript ---
C:\Data
>chcp
Active code page: 65001
C:\Data
>testutf8.py
h=F2l=E1
Traceback (most recent call last):
File "C:\Data\testutf8.py", line 1, in ?
print u'h\xf2l\xe1'.encode("utf-8")
IOError: [Errno 2] No such file or directory
C:\Data
>type testutf8.py
print u'h\xf2l\xe1'.encode("utf-8")