Python3: Sane way to deal with broken encodings

Johannes Bauer dfnsonfsduifb at gmx.de
Mon Dec 7 14:16:38 EST 2009


Bruno Desthuilliers schrieb:

>> Is that possible? If so, how?
> 
> This might get you started:
> 
> """
>>>> help(str.decode)
> decode(...)
>     S.decode([encoding[,errors]]) -> object

Hmm, this would work nicely if I called "decode" explicitly - but what
I'm doing is:

#!/usr/bin/python3
for line in open("broken", "r"):
	pass

Which still raises the UnicodeDecodeError when I do not even do any
decoding explicitly. How can I achieve this?

Kind regards,
Johannes

-- 
"Aus starken Potentialen können starke Erdbeben resultieren; es können
aber auch kleine entstehen - und "du" wirst es nicht für möglich halten
(!), doch sieh': Es können dabei auch gar keine Erdbeben resultieren."
-- "Rüdiger Thomas" alias Thomas Schulz in dsa über seine "Vorhersagen"
<1a30da36-68a2-4977-9eed-154265b17d28 at q14g2000vbi.googlegroups.com>



More information about the Python-list mailing list