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-05 14:25:56 -0400
commit946ee144ab08c4c0d12896541eb6ed7764cfd3c8 (patch)
treec8a1387a1566da7bb743dfff20f1b9b746012ebf
parent709f7d15b733e3ca579b8371e0ebe021dfcef139 (diff)
downloadb4-946ee144ab08c4c0d12896541eb6ed7764cfd3c8.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 745485e..483173c 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1278,7 +1278,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')