fall back for UnicodeDecodeError
This commit is contained in:
parent
85130e175b
commit
3a1af9f424
|
@ -503,7 +503,11 @@ def parseaddr_unicode(addr) -> (str, str):
|
||||||
name = name.strip()
|
name = name.strip()
|
||||||
decoded_string, charset = decode_header(name)[0]
|
decoded_string, charset = decode_header(name)[0]
|
||||||
if charset is not None:
|
if charset is not None:
|
||||||
|
try:
|
||||||
name = decoded_string.decode(charset)
|
name = decoded_string.decode(charset)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
LOG.warning("Cannot decode addr name %s", name)
|
||||||
|
name = ""
|
||||||
else:
|
else:
|
||||||
name = decoded_string
|
name = decoded_string
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue