diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-08-05 14:25:56 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-08-13 10:37:13 -0400 |
commit | 7d78e0b2aa399353bdec9714208aa0fa202c9fe7 (patch) | |
tree | 8b2b44b305259994d6a280bf1dac036e082b0ea1 | |
parent | f6071de6ac07157aeddd19466b5b84449c6ea1b1 (diff) | |
download | b4-7d78e0b2aa399353bdec9714208aa0fa202c9fe7.tar.gz |
Handle decoding incorrectly encoded headers
Sometimes the encoding indicated in the header lies and it's not actualy
that codepage at all. When that happens, just replace errors and
continue.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 209f88a..34b5a08 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1161,7 +1161,7 @@ class LoreMessage: if hcs is None: hcs = 'utf-8' try: - decoded += hstr.decode(hcs) + decoded += hstr.decode(hcs, errors='replace') except LookupError: # Try as utf-u decoded += hstr.decode('utf-8', errors='replace') |