#18431: Decode encoded words in atoms in new email parser.

There is more to be done here in terms of accepting RFC invalid
input that some mailers accept, but this covers the valid
RFC places where encoded words can occur in structured headers.
This commit is contained in:
R David Murray 2013-07-12 16:00:28 -04:00
parent 65171b28e7
commit 923512f327
4 changed files with 73 additions and 3 deletions

View file

@ -158,6 +158,10 @@ class TestUnstructuredHeader(TestHeaderBase):
'=?utf-8?q?=C3=89ric?=',
'Éric'),
'rfc2047_quopri_with_regular_text': (
'The =?utf-8?q?=C3=89ric=2C?= Himself',
'The Éric, Himself'),
}
@ -1119,6 +1123,26 @@ class TestAddressHeader(TestHeaderBase):
'example.com',
None),
'rfc2047_atom_is_decoded':
('=?utf-8?q?=C3=89ric?= <foo@example.com>',
[],
'Éric <foo@example.com>',
'Éric',
'foo@example.com',
'foo',
'example.com',
None),
'rfc2047_atom_in_phrase_is_decoded':
('The =?utf-8?q?=C3=89ric=2C?= Himself <foo@example.com>',
[],
'"The Éric, Himself" <foo@example.com>',
'The Éric, Himself',
'foo@example.com',
'foo',
'example.com',
None),
}
# XXX: Need many more examples, and in particular some with names in