Skip to content

Commit

Permalink
Merge pull request #184 from py-radicz/issue#169
Browse files Browse the repository at this point in the history
attempt to fix issue 169/177
  • Loading branch information
martinrusev committed Jun 2, 2020
2 parents 7af3f98 + 45a417e commit 9bb752b
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 @@ -137,7 +138,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 9bb752b

Please sign in to comment.