Printing characters outside of the ASCII range

Andrew Berg bahamutzero8825 at gmail.com
Fri Nov 9 16:39:13 EST 2012


On 2012.11.09 15:17, danielk wrote:
> I guess the question I have is: How do you tell Python to use a specific encoding for 'print' statements when I know there will be characters outside of the ASCII range of 0-127?
You don't. It's raising that exception because the terminal cannot
display that character, not because it's using the wrong encoding. As
Ian mentioned, chr() on Python 2 and chr() on Python 3 return two
different things. I'm not very familiar with the oddities of Python 2,
but I suspect sending bytes to the terminal could work since that is
what chr() on Python 2 returns.
-- 
CPython 3.3.0 | Windows NT 6.1.7601.17835



More information about the Python-list mailing list