This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients barry, r.david.murray, remi.lapeyre, skreft
Date 2018-11-12.23:50:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542066638.81.0.788709270274.issue35222@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the report, but parseaddr and formataddr are defined *only* for ASCII.  In the port to python3, parseaddr sort-of-maybe-sometimes does the naively expected thing with non-ascii, but that's just an accident.  We could have added a check for non-ascii to parseaddr during the python3 port, but we didn't think of it, and it is too late now since adding it would break otherwise working code even though that code is technically broken.

So, for the defined API of parseaddr/formataddr, there is no bug here.

As for handling non-ascii in email per your link:

    >>> from email.message import EmailMessage
    >>> from email.policy import default
    >>> m = EmailMessage(policy=default.clone(utf8=True))
    >>> m['From'] = 'skreft+ñandú@sudoai.com
    >>> bytes(m)
    b'From: skreft+\xc3\xb1and\xc3\xba@sudoai.com\n\n'

(NB: in testing the above I discovered there is actually a recent bug in the serialization when utf8 is *False*: it does RFC2047 encoding of the username, which it should not do...instead it should raise an error.  Feel free to open a bug report for that...)
History
Date User Action Args
2018-11-12 23:50:38r.david.murraysetrecipients: + r.david.murray, barry, skreft, remi.lapeyre
2018-11-12 23:50:38r.david.murraysetmessageid: <1542066638.81.0.788709270274.issue35222@psf.upfronthosting.co.za>
2018-11-12 23:50:38r.david.murraylinkissue35222 messages
2018-11-12 23:50:38r.david.murraycreate