RFC 2045 quoted printable encoding and decoding utilities. This API is backwards compatible with the Gauche library rfc.quoted-printable.
(define (mime-encode-header header value charset)
(let ((prefix (string-append header ": "))
(str (ces-convert value "UTF8" charset)))
(string-append
prefix
(quoted-printable-encode-header charset str (string-length prefix)))))
Return a quoted-printable encoded representation of the input
according to the official standard as described in RFC2045.
? and _ are always encoded for compatibility with RFC1522
encoding, and soft newlines are inserted as necessary to keep each
lines length less than max-col
(default 76). The starting
column may be overridden with start-col
(default 0).Variation of the above to read and write to ports.Return a quoted-printable encoded representation of string as
above, wrapped in =?ENC?Q?...?= as per RFC1522, split across
multiple MIME-header lines as needed to keep each lines length
less than max-col
. The string is encoded as is, and the
encoding enc
is just used for the prefix, i.e. you are
responsible for ensuring str
is already encoded according to
enc
.Return a quoted-printable decoded representation of str
. If
mime-header?
is specified and true, _ will be decoded as as
space in accordance with RFC1522. No errors will be raised on
invalid input.Variation of the above to read and write to ports.