Fixed encoding error in get_email

This commit is contained in:
andresf01 2017-07-11 10:09:47 -05:00
parent db223abe27
commit 7386a45784

View File

@ -323,7 +323,10 @@ def ticket_from_message(message, queue, logger):
decodeUnknown(part.get_content_charset(), part.get_payload(decode=True))
)
# workaround to get unicode text out rather than escaped text
body = body.encode('ascii').decode('unicode_escape') if six.PY3 else body.encode('utf-8')
try:
body = body.encode('ascii').decode('unicode_escape')
except UnicodeEncodeError:
body.encode('utf-8')
logger.debug("Discovered plain text MIME part")
else:
files.append(