On Mon, Dec 7, 2009 at 2:16 PM, Johannes Bauer <dfnsonfsdu...@gmx.de> wrote: > 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 >
Looking at the python 3 docs, it seems that open takes the encoding and errors parameters as optional arguments. So you can call open('broken', 'r',errors='replace') > -- > "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-154265b17...@q14g2000vbi.googlegroups.com> > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list