This might also be interesting for corner-cases: In case the decoding fails, one could fallback to the
chardet module, and try to detect the real encoding. And even if then there are still errors or the encoding couldn't be detected properly, just do a .decode(..., 'ignore'/'replace') possibly instead of crashing? I'm not sure what the module currently does.