aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index ad417e6..2e12b60 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -682,7 +682,13 @@ class LoreMessage:
pcharset = part.get_content_charset()
if not pcharset:
pcharset = mcharset
- payload = payload.decode(pcharset, errors='replace')
+ try:
+ payload = payload.decode(pcharset, errors='replace')
+ except LookupError:
+ # what kind of encoding is that?
+ # Whatever, we'll use utf-8 and hope for the best
+ payload = payload.decode('utf-8', errors='replace')
+ part.set_param('charset', 'utf-8')
if self.body is None:
self.body = payload
continue