For Gauche 0.9.5


Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]

12.39 rfc.quoted-printable - Quoted-printable encoding/decoding

Module: rfc.quoted-printable

This module defines a few functions to encode/decode Quoted-printable format, defined in RFC 2045 (RFC2045), section 6.7.

Function: quoted-printable-encode :key line-width binary

Reads byte stream from the current input port, encodes it in Quoted-printable format and writes the result character stream to the current output port. The conversion ends when it reads EOF from the current input port. The keyword argument line-width specifies the maximum line width of the generated output in characters. If the encoded output creates a long line, the procedure inserts a “soft line break” so that the each line is equal to or shorter than this number. Soft line breaks are removed when quoted-printable text is decoded. The default line width is 76. (The minimum meaningful number of line-width is 4). You can suppress soft line breaks by giving #f or 0 to line-width. By default, quoted-printable-encode generates CR-LF sequence for each line break in the input (“hard line break”). When a true value is given to the keyword argument binary, however, octets #x0a and #x0d in the input are encoded as =0A and =0D, respectively. See RFC2045 section 6.7 for the details.

Function: quoted-printable-encode-string string :key line-width binary

Converts contents of string to Quoted-printable encoded format. Input string can be either complete or incomplete string; it is always interpreted as a byte sequence.

The keyword arguments are the same as quoted-printable-encode.

Function: quoted-printable-decode

Reads character stream from the current input port, decodes it from Quoted-printable format and writes the result byte stream to the current output port. The conversion ends when it reads EOF. If it encounters illegal character sequence (such as ’=’ followed by non-hexadecimal characters), it copies them literally to the output.

Function: quoted-printable-decode-string string

Decodes a Quoted-printable encoded string string and returns the result as a string.


Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]