[Email-SIG] Python's quoprimime encoder
Mark Sapiro
msapiro at value.net
Fri Mar 2 23:25:04 CET 2007
Nicholas Cole wrote:
>
>Sorry if the above was not clear. I suppose I should have asked: why
>does the python quoted printable encoder not encode the trailing
>whitespace on each line - a proceedure which is (AFAICS) standard.
First of all, it is difficult to see what your input in the OP was in
terms of what explicit trailing whitespace there was. Also, that
notwithstanding, it is clear that your 'result' didn't come exactly
from your input as your result has a period after 'test' that wasn't
in the input.
Anyway, the 'standard' that defines quoted-printable encoding is RFC
2045, and it is flexible in that it allows more than one way to encode
the same thing. The only thing that determines whether a particular
encoded string is correct is whether it decodes properly back to the
original.
In particular "xxx =\n\nyyy\n" and "xxx=20\nyyy\n" are two equivalent
ways to quoted-printable encode the two lines "xxx " followed by
"yyy". In the first case, the trailing space is literally a space
character, but since the standard doesn't allow a line ending with a
literal space, it is joined to a following empty line. In the second
case, the trailing space is encoded as =20. One may be more common
than the other, although I see lots of email encoded the former way,
but they are both correct encodings and neither is shorter than the
other.
--
Mark Sapiro <msapiro at value.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Email-SIG
mailing list