Email subjects not encoded properly
|Reported by:||Thomas Petazzoni <thomas.petazzoni@…>||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When providing an UTF-8 encoded subject to the EmailMessage class constructor, the subject is sent directly in UTF-8, without being encoded in Quoted-Printable or Base 64. When the MUA of the recepient is running on a machine with UTF-8, it "works", but with recipients having their machines running ISO-8859-x or other non-UTF-8 charset, the subject appears broken.
I think the problem comes from the implementation of the setitem method of the SafeMIMEText class. It only uses the Header() class when str(force_unicode(val)) raises an exception, which it doesn't do in my case (I suppose because my subject is properly UTF-8 encoded). However, I'd say it should *always* use Header(), which properly turns an UTF-8 string to a quoted-printable string.
I'm running Django trunk at r6526.
Don't hesitate to ask for further details if needed.
Change History (8)
Changed 6 years ago by Thomas Petazzoni <thomas.petazzoni@…>
comment:1 Changed 6 years ago by mtredinnick
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:6 Changed 6 years ago by mtredinnick
- Resolution set to fixed
- Status changed from new to closed