R. David Murray <[email protected]> added the comment:
OK, I've finally gotten around to looking at this. It looks like quopri and
binascii are not stripping trailing whitespace.
quoprimime binascii quopri preferred
b'=' '' b'' b'=' '='
b'= ' '' b'= ' b'= ' '='
b'= \n' '' b'= \n' b'' quoprimime binascii
quopri
b'=' '' b'' b'='
b'= ' '' b'= ' b'= '
b'= \n' '' b'= \n' b''
b'=\r' '' b'' b'=\r'
b'==41' '=A' b'=41' b'=41' '=\n'
b'=\r' '' b'' b'=\r' '=\r'
b'==41' '=A' b'=41' b'=41' '=A'
b'= \n f\n' ' f\n' b'= \n f\n' b'= \n f\n' ' f\n'
The RFC recommends that a trailing = be preserved, but that trailing whitespace
be ignored. It doesn't speak directly to the ==41 case, but one can infer that
the first = in the == pair is most likely to have "come from the source text"
and not been encoded, while the =41 was an intentional encoding and so should
be decoded.
Now, that said, the actual behavior that our libraries have had for a long time
is to treat the "last line" just like all other lines, and strip a trailing =.
So I would be inclined to keep that behavior for backward compatibility reasons
rather than change it to be more RFC compliant, given that we don't have any
actual bug report related to it, and "fixing" it could break things. Given
that, the current quoprimime behavior becomes the reference.
However, backward compatibility concerns also arise around starting to strip
trailing space in quopri and binascii. Maybe we only make that change in 3.8?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue18022>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com