Skip to content

Commit

Permalink
Merge pull request #203 from kapalex/master
Browse files Browse the repository at this point in the history
fix false exception on unknown encoding #202
  • Loading branch information
martinrusev committed Jul 20, 2021
2 parents c15838f + eb8400a commit 00b21b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions imbox/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def decode_mail_header(value, default_charset='us-ascii'):
return str_decode(str_encode(value, default_charset, 'replace'), default_charset)
else:
for index, (text, charset) in enumerate(headers):
logger.debug("Mail header no. {index}: {data} encoding {charset}".format(
index=index,
data=str_decode(text, charset or 'utf-8', 'replace'),
charset=charset))
try:
logger.debug("Mail header no. {index}: {data} encoding {charset}".format(
index=index,
data=str_decode(text, charset or 'utf-8', 'replace'),
charset=charset))
headers[index] = str_decode(text, charset or default_charset,
'replace')
except LookupError:
Expand Down

0 comments on commit 00b21b2

Please sign in to comment.