[PythonCE] UnicodeDecodeError with print

Michael Foord mike at pcblokes.com
Mon Mar 14 13:03:30 CET 2005


I am wondering if anyone knows the reason as to why :

print u'£'

should cause a UnicodeDecodeError on pythonce ? (The usual 'ascii codec 
cannot decode character...' message).

Obviously the '£' character is a non-ascii character. I am just 
surprised that the print statement is using the ascii encoding at all 
and not just passing the string to sys.stdout.

The particular reason I ask is that this doesn't happen with 'normal' 
python... but I would like to know how the print statement decodes 
unicode strings it prints. Since it *doesn't* raise an error normally it 
obviously doesn't use defaultencoding - so why does the pyhonce one ?

Yours curiously,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml


More information about the PythonCE mailing list