Why does Python print unicode characters when the default encoding is ASCII?
Posted
by mike
on Stack Overflow
See other posts from Stack Overflow
or by mike
Published on 2010-04-08T00:03:08Z
Indexed on
2010/04/08
0:23 UTC
Read the original article
Hit count: 295
From the Python 2.6 shell:
>>> import sys
>>> print sys.getdefaultencoding()
ascii
>>> print u'\xe9'
é
>>>
I expected to have either some gibberish or an Error after the print statement, since the "é" character isn't part of ASCII and I haven't specified an encoding. I guess I don't understand what ASCII being the default encoding means.
© Stack Overflow or respective owner