#28196: Character Encoding on EmailMessage when sending
-------------------------------------+-------------------------------------
Reporter: Helmut | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.11
Uncategorized | Keywords: emailmessage, send,
Severity: Normal | email, unicode
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I'm not 100% sure if this is bug, or whether my understand of unicode is
wrong. Nevertheless Django 1.11 behaves differently than 1.10.7. Using
Django 1.10.7, if I send an Email using EmailMessage, but I encode the
subject and body with UTF-8, it sends successfully. For example:
{{{#!python
email = EmailMessage("asd’asd".encode("utf-8"), "asd’asd".encode("utf-8"),
"[email protected]", ["[email protected]"])
email.send()
}}}
But if I run the same code in Django 1.11, it throws an exception because
of the unicode character that was used:
'ascii' codec can't decode byte 0xe2 in position 92: ordinal not in
range(128)
So, might there be a bug in 1.11, or should I not be using the ".encode"?
(Was using that because of weird user input)
And furthermore, why does pre-1.11 not throw an exception?
I thank you for you attention.
--
Ticket URL: <https://code.djangoproject.com/ticket/28196>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.ce8a712ee740d4335c2a9a9e412300fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.