Python UTF-8 and codecs
Dennis Benzinger
Dennis.Benzinger at gmx.net
Tue Jun 27 15:10:44 EDT 2006
Mike Currie wrote:
> 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
> [...]
You want to write to a file but you used the 'rU' mode. This should be
'wU'. Don't know if this is the only reason it doesn't work. Could you
show more of your code?
Bye,
Dennis
More information about the Python-list
mailing list