Opened 16 years ago

Closed 15 years ago

Last modified 13 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: no UI/UX: no

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 16 years ago.
Use email.Utils.getaddresses instead of toaddrstring.split(",")
bug11144.2.patch (1.6 KB ) - added by rmt 15 years ago.
Use email.Utils.getaddresses instead of toaddrstring.split(",") + regression test

Download all attachments as: .zip

Change History (8)

comment:1 by James Bennett, 16 years ago

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.

by rmt, 16 years ago

Attachment: bug11144.patch added

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

comment:2 by rmt, 16 years ago

Has patch: set

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

by rmt, 15 years ago

Attachment: bug11144.2.patch added

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

comment:3 by rmt, 15 years ago

milestone: 1.2

Ping? Has anybody looked at this again?

comment:4 by Russell Keith-Magee, 15 years ago

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 by Russell Keith-Magee, 15 years ago

(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 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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