Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#11144 closed (fixed)

UnicodeEncodeError when unicode characters present in To/From/Cc and also a comma is present

Reported by: anonymous Owned by: nobody
Component: Core (Mail) Version: 1.0
Severity: Keywords: UnicodeEncodeError
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This address will work fine: "Joe Blöggs" <joe.bloggs@…>

However, this address will fail: "Blöggs, Joe" <joe.bloggs@…>

The reason is because Django is doing a simple val.split(",") instead of proper parsing of the addresses.

Bug location: django/core/mail.py:forbid_multi_line_headers line 82 (In 1.0.2 at least)

It's also present in the dev version!

Attachments (2)

bug11144.patch (1002 bytes) - added by rmt 8 years ago.
Use email.Utils.getaddresses instead of toaddrstring.split(",")
bug11144.2.patch (1.6 KB) - added by rmt 8 years ago.
Use email.Utils.getaddresses instead of toaddrstring.split(",") + regression test

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by James Bennett

milestone: 1.1
Triage Stage: UnreviewedDesign decision needed

So far as I know, Django doesn't attempt to support every address/name format permitted by the RFC. But regardless of the decision on this one, it's not a milestone 1.1 bug -- only critical blockers are being accepted for that now.

Changed 8 years ago by rmt

Attachment: bug11144.patch added

Use email.Utils.getaddresses instead of toaddrstring.split(",")

comment:2 Changed 8 years ago by rmt

Has patch: set

Patch attached. Although handling header encoding in a function named forbid_multi_line_headers doesn't seem optimal.

Changed 8 years ago by rmt

Attachment: bug11144.2.patch added

Use email.Utils.getaddresses instead of toaddrstring.split(",") + regression test

comment:3 Changed 7 years ago by rmt

milestone: 1.2

Ping? Has anybody looked at this again?

comment:4 Changed 7 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [11719]) Fixed #11144 -- When a to/from/cc header contains unicode, make sure the email addresses are parsed correctly (especially with regards to commas). Thanks to rmt for the patch.

comment:5 Changed 7 years ago by Russell Keith-Magee

(In [11720]) [1.1.X] Fixed #11144 -- When a to/from/cc header contains unicode, make sure the email addresses are parsed correctly (especially with regards to commas). Thanks to rmt for the patch.

Backport of r11719 from trunk.

comment:6 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top