diff --git a/helpdesk/email.py b/helpdesk/email.py index 2e076585..9bf442f2 100644 --- a/helpdesk/email.py +++ b/helpdesk/email.py @@ -481,9 +481,15 @@ def object_from_message(message, queue, logger): body.encode('utf-8') logger.debug("Discovered plain text MIME part") else: - payload = encoding.smart_bytes(part.get_payload(decode=True)) + payload = """ + + + + +%s +""" % encoding.smart_text(part.get_payload(decode=True)) files.append( - SimpleUploadedFile(_("email_html_body.html"), payload, 'text/html') + SimpleUploadedFile(_("email_html_body.html"), payload.encode("utf-8"), 'text/html') ) logger.debug("Discovered HTML MIME part") else: diff --git a/helpdesk/tests/test_get_email.py b/helpdesk/tests/test_get_email.py index 78bf1a6f..50a5f1e5 100644 --- a/helpdesk/tests/test_get_email.py +++ b/helpdesk/tests/test_get_email.py @@ -71,7 +71,7 @@ class GetEmailCommonTests(TestCase): attachments = FollowUpAttachment.objects.filter(followup=followup) self.assertEqual(len(attachments), 1) attachment = attachments[0] - self.assertEqual(attachment.file.read().decode("utf-8"), '
Tohle je test českých písmen odeslaných z gmailu.
\n') + self.assertIn('
Tohle je test českých písmen odeslaných z gmailu.
\n', attachment.file.read().decode("utf-8")) def test_email_with_8bit_encoding_and_utf_8(self): """