Quoted-printable
|
Quoted-printable is an encoding using ASCII characters for non-ASCII text. It is defined as a MIME content transfer encoding for use in Internet e-mail.
Introduction
The basic Internet e-mail transmission protocol, SMTP, supports only ASCII characters (see also 8BITMIME). MIME defines mechanisms for sending other kinds of information in e-mail, including text in languages other than English using character encodings other than ASCII. Quoted-printable encoding is one method used for mapping non-ASCII characters into sequences of ASCII characters. This encoding is reversible, meaning the original non-ASCII characters can be recovered.
Quoted-printable and Base64 are the two basic MIME content transfer encodings. If the input text is mostly ASCII, quoted-printable results in a fairly readable encoded result. For input that is either not text or mostly not ASCII, Base64 results in a smaller encoded result but is not readable.
Quoted Printable Encoding
Any 8-bit byte value may be encoded with 3 characters, an "=" followed by two hexadecimal digits (0-9 or A-F) representing the byte's numeric value. For example, a US-ASCII form feed character (decimal value 12) can be represented by "=0C", and a US-ASCII equal sign (decimal value 61) is represented by "=3D". All characters except printable ASCII characters or end of line characters must be encoded in this fashion.
Printable ASCII characters except "=", i.e. those with decimal values between 33 and 126 excepting decimal value 61, may be represented by themselves.
ASCII tab and space characters, decimal values 9 and 32, may be represented by themselves except if these characters appear at the end of a line. If one of these characters appears at the end of a line it must be encoded as "=09" (tab) or "=20" (space).
End of line characters, a carriage return (decimal value 13) followed by a line feed (decimal value 10), receive special treatment. If this pair of characters is used in the input format to mean end of line, as is common for many text formats, this pair of characters must be represented by themselves. If the input format is not text, or uses a different end of line indicator these characters must be encoded as "=0D" and "=0A" respectively.
Lines of quoted-printable encoded data must not be longer than 76 characters. To satisfy this requirement soft line breaks may be added as desired. A soft line break consists of an "=" at the end of an encoded line.