Python UTF-8 and codecs

Mike Currie dev at null.com
Tue Jun 27 14:48:43 EDT 2006


I'm trying to write out files that have utf-8 characters 0x85 and 0x08 in 
them.  Every configuration I try I get a UnicodeError: ascii codec can't 
decode byte 0x85 in position 255: oridinal not in range(128)

I've tried using the codecs.open('foo.txt', 'rU', 'utf-8', errors='strict') 
and that doesn't work and I've also try wrapping the file in an utf8_writer 
using codecs.lookup('utf8')

Any clues?

Thanks
Mike





More information about the Python-list mailing list