The purpose of this sub-module is to decode/encode inline quoted-printable data described by RFC2047. Header of an email can not emit in anyway (before RFC6532) bytes encoded into 8 bits. To be able to use an encoding such as latin1 or UTF-8, we can use an inlined quoted-printable text.
src d s j l provides
l bytes to read, starting at
s. This byte range is read by calls to
`Await is returned. To signal the end of input, call the function with
l = 0.
decode d is:
`Manualinput source and awaits for more input. The client must use
srcto provide it.
`Endif the end of input was reached.
`Malformed bytesif the
bytessequence is malformed according to the decoded quoted-printable encoding scheme. If you are interested in a best-effort decoding you can still continue to decode after an error until the decode synchronizes again on valid bytes.
`Data dataif a
datasequence value was decoded.
`Line lineif a
line sequence value plus a line-break was decoded.
Note. Repeated invocation always eventually returns
`End, even in case of errors.
val decoder_byte_count : decoder -> int
decoder_byte_count d is the number of characters already decoded on
d (included malformed ones). This is the last
decode's end output offset counting from beginning of the stream.
encode encoder is:
`Manualdestination and needs more output storage. The client must use
dstto provide a new buffer and then call
`Okwhen the encoder is ready to encode a new
`Manual destination, encoding
`End always return
`Partial, the client should continue as usual with
`Ok is returned at which point
encoder is guaranteed to be the sode of the last provided buffer (i.e. nothing was written).
Invalid_argument if a
`End is encoded after a