From 7d78e0b2aa399353bdec9714208aa0fa202c9fe7 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Thu, 5 Aug 2021 14:25:56 -0400 Subject: 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 --- b4/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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') -- cgit v1.2.3