Long way around UnicodeDecodeError, or 'ascii' codec can't decode byte

Oleg Parashchenko olepar at gmail.com
Thu Mar 29 06:26:10 CEST 2007


Hello,

I'm working on an unicode-aware application. I like to use "print" to
debug programs, but in this case it was nightmare. The most popular
result of "print" was:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xXX in position
0: ordinal not in range(128)

I spent two hours fixing it, and I hope it's done. The solution is one
of the ugliest hack I ever written, but it solves the pain. The full
story and the code is in my blog:

http://uucode.com/blog/2007/03/23/shut-up-you-dummy-7-bit-python/

--
Oleg Parashchenko  olpa@ http://uucode.com/
http://uucode.com/blog/  Generative Programming, XML, TeX, Scheme
http://tohtml.com/       Online syntax highlighting




More information about the Python-list mailing list