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?=" <anita.wiecklin...@pato.com.pl>"')
('=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=\n 
=?UTF-8?Q?omo=C5=9Bci?=', 'anita.wiecklin...@pato.com.pl')

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?=" <anita.wiecklin...@pato.com.pl>"\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 <rep...@bugs.python.org>
<http://bugs.python.org/issue31089>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to