print u"\u0432": why is this so hard? UnciodeEncodeError

Jon Willeke j.dot.willeke at verizon.dot.net
Wed Apr 7 22:21:06 EDT 2004


Nelson Minar wrote:
> I have a simple goal. I want the following Python program to work:
>   print u"\u0432"
> 
> This program fails on my US Debian machine:
>   UnicodeEncodeError: 'ascii' codec can't encode character u'\u0432' in position 0: ordinal not in range(128)

Try playing with sys.setdefaultencoding().  You'll need to reload( sys ) 
to call it.  If it solves your problem, you can make it permanent by 
modifying site.py.



More information about the Python-list mailing list