python / cpython

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

quopri RFC 2047 and hex 20 encodings #35227

Closed warsaw closed 23 years ago

warsaw commented 23 years ago
BPO 463996
Nosy @loewis, @warsaw

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 = ['library'] title = 'quopri RFC 2047 and hex 20 encodings' updated_at = user = 'https://github.com/warsaw' ``` bugs.python.org fields: ```python activity = actor = 'loewis' assignee = 'none' closed = True closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'barry' dependencies = [] files = [] hgrepos = [] issue_num = 463996 keywords = [] message_count = 4.0 messages = ['6649', '6650', '6651', '6652'] nosy_count = 3.0 nosy_names = ['loewis', 'barry', 'kente'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue463996' versions = [] ```

warsaw commented 23 years ago

In RFC 2047, the quoted-printable (i.e. "Q") encoding allows for _ to encode hex 20. See section 4.2 of that RFC. However, quopri was written against RFC 1521 which doesn't describe hex20/underscore encoding.

quopri should be updated to allow for decoding of underscore to hex 20, perhaps as a flag on the decode() and decodestring() functions.

97a7f336-0601-47fb-8c1d-73f34e59fd37 commented 23 years ago

Logged In: YES user_id=178855

We should not directly compare RFC 2047 and RFC 1521.

RFC 1521 = Old standard, "QP for bodies" RFC 1522 = Old standard, "QP for headers"

RFC 2045 = New standard, "QP for bodies" RFC 2027 = New standard, "QP for headers"

The "underscore coding" is present already in RFC 1522, and absent in RFC 2045.

A flag sent to the relevant functions may be the right way, but we want it to be something like "header_style", not "new_style".

97a7f336-0601-47fb-8c1d-73f34e59fd37 commented 23 years ago

Logged In: YES user_id=178855

See patch 464070 for a minimal decode enhancement.

61337411-43fc-4a9c-b8d5-4060aede66d0 commented 23 years ago

Logged In: YES user_id=21627

I believe this bug has been fixed with patch bpo-462190, which has been committed. If there are still open issues left, please indicate what they are, and we'll re-open the report.