Python – dealing with mixed-encoding files
If you try to decode this string as utf-8, as you already know, you will get an “UnicodeDecode” error, as these spurious cp1252 characters are invalid utf-8 – However, Python codecs allow you to register a callback to handle encoding/decoding errors, with the codecs.register_error function – it gets the UnicodeDecodeerror a a parameter – you … Read more