Closed kronion closed 6 years ago
Django 1.11+ converts the content of email attachments to unicode if the attachment content type is text/*. See https://github.com/django/django/blob/stable/1.11.x/django/core/mail/message.py#L379. For Python2 applications, this library was trying to re-encode the content as if it was ascii, which would error on unicode characters.
text/*
Explicitly encode utf-8, rather than relying on the Python default encoding. Also add a test case.
Django 1.11+ converts the content of email attachments to unicode if the attachment content type is
text/*
. See https://github.com/django/django/blob/stable/1.11.x/django/core/mail/message.py#L379. For Python2 applications, this library was trying to re-encode the content as if it was ascii, which would error on unicode characters.Explicitly encode utf-8, rather than relying on the Python default encoding. Also add a test case.