aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-08-05 14:25:56 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-08-13 10:37:13 -0400
commit7d78e0b2aa399353bdec9714208aa0fa202c9fe7 (patch)
tree8b2b44b305259994d6a280bf1dac036e082b0ea1
parentf6071de6ac07157aeddd19466b5b84449c6ea1b1 (diff)
downloadb4-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__.py2
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')