fall back for UnicodeDecodeError

This commit is contained in:
Son NK 2020-05-14 13:27:04 +02:00
parent 85130e175b
commit 3a1af9f424

View file

@ -503,7 +503,11 @@ def parseaddr_unicode(addr) -> (str, str):
name = name.strip()
decoded_string, charset = decode_header(name)[0]
if charset is not None:
try:
name = decoded_string.decode(charset)
except UnicodeDecodeError:
LOG.warning("Cannot decode addr name %s", name)
name = ""
else:
name = decoded_string