* In base64 encoding remove all newlines from the encoded result, avoids
getting an invalid result.
* In qp encoding:
- replace all spaces by underlines, not just the first (looks like a
typo in the previous code)
- encode "?"s and "_"s too, as required for this encoding
- remove soft newlines (again, avoid an invalid result)
* Use `regexp-replace*' to encode the parts between the lines. Besides
making the code simpler, it fixes a bug in the previous code where
multiple lines would each get encoded and the results concatenated
without the newlines or any other whitespace.
* When the string to be encoded is longer than 70 characters, split and
encode the sub-parts, then concatenate the encodings with a "\n "
separator. This is done as a poor attempt to follow the line length
limits specified in rfc2047, or more concretely, to avoid sendmail's
"!\n " splitting.
* Use `re:non-ascii' to look for a non-ascii character => faster.
* Use either CR or LF for a newline, not just LF.
* Use `regexp-replace*' to encode the parts between the lines. Besides
making the code simpler, it fixes a bug in the previous code where
multiple lines would each get encoded and the results concatenated
without the newlines or any other whitespace.