[issue31089] email.utils.parseaddr fails on odd double quotes in multiline header
R. David Murray
report at bugs.python.org
Mon Jul 31 11:32:47 EDT 2017
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.wiecklinska at pato.com.pl>"')
('=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=\n =?UTF-8?Q?omo=C5=9Bci?=', 'anita.wiecklinska at 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.wiecklinska at 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 <report at bugs.python.org>
<http://bugs.python.org/issue31089>
_______________________________________
More information about the Python-bugs-list
mailing list