Unicode problem with exec
Thomas Heller
theller at python.net
Fri Jun 23 07:06:18 EDT 2006
I'm using code.Interactive console but it doesn't work correctly
with non-ascii characters. I think it boils down to this problem:
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print u"ä"
ä
>>> exec 'print u"ä"'
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<string>", line 1, in ?
File "c:\python24\lib\encodings\cp850.py", line 18, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\x84' in position 0: character maps to <undefined>
>>> ^Z
Why does the exec call fail, and is there a workaround?
Thanks,
Thomas
More information about the Python-list
mailing list