mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-26 16:48:50 +01:00
Specify encoding of html email bodies explicitly
This commit is contained in:
parent
6693496214
commit
6886a7920e
@ -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 = """
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
</head>
|
||||
%s
|
||||
</html>""" % 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:
|
||||
|
@ -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"), '<div dir="ltr">Tohle je test českých písmen odeslaných z gmailu.</div>\n')
|
||||
self.assertIn('<div dir="ltr">Tohle je test českých písmen odeslaných z gmailu.</div>\n', attachment.file.read().decode("utf-8"))
|
||||
|
||||
def test_email_with_8bit_encoding_and_utf_8(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user