python / cpython

The Python programming language
https://www.python.org
Other
62.47k stars 29.99k forks source link

email.Header.decode_header() doesn't work if encoded-word was separeted by CRLF #48741

Closed f76e6224-bf87-486c-9d7b-4352d21c7be7 closed 14 years ago

f76e6224-bf87-486c-9d7b-4352d21c7be7 commented 15 years ago
BPO 4491
Nosy @warsaw, @atsuoishimoto
Superseder
  • bpo-1079: decode_header does not follow RFC 2047
  • Files
  • email.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['type-bug', 'library'] title = "email.Header.decode_header() doesn't work if encoded-word was separeted by CRLF" updated_at = user = 'https://github.com/atsuoishimoto' ``` bugs.python.org fields: ```python activity = actor = 'terry.reedy' assignee = 'none' closed = True closed_date = closer = 'terry.reedy' components = ['Library (Lib)'] creation = creator = 'ishimoto' dependencies = [] files = ['12196'] hgrepos = [] issue_num = 4491 keywords = ['patch'] message_count = 3.0 messages = ['76755', '81071', '85367'] nosy_count = 4.0 nosy_names = ['barry', 'ishimoto', 'tlynn', 'tony_nelson'] pr_nums = [] priority = 'normal' resolution = 'duplicate' stage = 'resolved' status = 'closed' superseder = '1079' type = 'behavior' url = 'https://bugs.python.org/issue4491' versions = ['Python 2.6', 'Python 2.5', 'Python 2.7'] ```

    f76e6224-bf87-486c-9d7b-4352d21c7be7 commented 15 years ago

    email.Header.decode_header() doesn't work if encoded-word was separeted by CRLF.

    For exmaple, decode_header('=?iso-8859-1?q?hello?=\r\n world.') returns [('=?iso-8859-1?q?hello?=\r\n world.', None)], not [('hello', 'iso-8859-1'), (' world.', None)].

    This bug was caused by rev.54371, bug bpo-1582282. I attached a patch to fix problem and test-case.

    50637b17-1fd1-4c83-96a6-3dd5e6e3b094 commented 15 years ago

    Duplicates bpo-1079.

    a42d0aba-ca34-41c4-9edf-690faa79a2cd commented 15 years ago

    See patch in bpo-1079. I don't think email.header can require whitespace until it decodes parsed headers, as whitespace is not always required.