Skip to content

Commit

Permalink
attempt to fix issue 169/177
Browse files Browse the repository at this point in the history
  • Loading branch information
py-radicz committed May 21, 2020
1 parent f794d1b commit 45a417e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion imbox/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import io
import re
import email
import chardet
import base64
import quopri
import sys
Expand Down Expand Up @@ -130,7 +131,10 @@ def decode_content(message):
try:
return content.decode(charset, 'ignore')
except LookupError:
return content.decode(charset.replace("-", ""), 'ignore')
encoding = chardet.detect(content).get('encoding')
if encoding:
return content.decode(encoding, 'ignore')
return content
except AttributeError:
return content

Expand Down

0 comments on commit 45a417e

Please sign in to comment.