New submission from Geoff Kuenning <[email protected]>:
Email.quopriprime creates a map of header and body bytes that need no encoding:
for c in b'-!*+/' + ascii_letters.encode('ascii') + digits.encode('ascii'):
_QUOPRI_HEADER_MAP[c] = chr(c)
This map is overly restrictive; in fact only two printable characters need to
be omitted: the space and the equals sign. The following revision to the loop
creates a correct table:
for c in list(range(33, 61)) + list(range(62, 127)):
_QUOPRI_HEADER_MAP[c] = chr(c)
Why does this matter? Well, first, it's wasteful since it creates messages
with larger headers than necessary. But more important, it makes it impossible
for other tools to operate on the messages unless they're encoding aware; for
example, one can't easily grep for "[email protected]" because the at sign is
encoded as =40.
----------
components: Library (Lib)
messages: 308181
nosy: gkuenning
priority: normal
severity: normal
status: open
title: Email.quopriprime over-encodes characters
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32298>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com