(chibi quoted-printable)

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)))))

(quoted-printable-encode-string src . o)

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).

(quoted-printable-encode-bytevector [sep max-col start-col src])

(quoted-printable-encode . o)

Variation of the above to read and write to ports.

(quoted-printable-encode-header encoding [nl max-col start-col src])

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.

(quoted-printable-decode-string src . o)

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.

(quoted-printable-decode-bytevector [src])

(quoted-printable-decode . o)

Variation of the above to read and write to ports.