R. David Murray added the comment:
parseaddr does what you expect if the message has been read using universal
newline mode (ie: the linesep is \n):
>>> parseaddr('"=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=\n
>>> =?UTF-8?Q?omo=C5=9Bci?=" <[email protected]>"')
('=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=\n
=?UTF-8?Q?omo=C5=9Bci?=', '[email protected]')
I suppose this wouldn't be *that* hard to fix. If it isn't too complex and you
want to propose a patch I'll take a look.
In any case it works fine in python3 using the new policies:
>>> from email import message_from_string as mfs
>>> from email.policy import default
>>> m = mfs('From: "=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=\r\n
>>> =?UTF-8?Q?omo=C5=9Bci?=" <[email protected]>"\r\n\r\ntest',
>>> policy=default)
>>> m['from'].addresses
(Address(display_name='Anita =W4\udc86iecklińska | PATO Nieruch omości',
username='anita.wiecklinska', domain='pato.com.pl'),)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue31089>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com