
Quoted Printable Encoding
Quoted Printable (QP), too, is a content transfer encoding, not a primary encoding of
characters. It is widely used especially for delivery of non-ASCII data by email. QP is
defined in the MIME specifications, namely in RFC 2045, “Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message Bodies.”
Like Base64, QP encodes any data, any octet stream. When used for character data,
this means that the data is already in some encoding, and QP applies another encoding
on top of it. In particular, you can have UTF-8 encoded data but encode it with QP to
make it safer for sending it through software that might munge octets with the first bit
set.
Logically, QP maps an octet string to an octet string, but we usually describe the result
string in terms of ASCII characters. If the original data is ASCII encoded, QP leaves
most printable characters intact. Similarly, if the data is UTF-8 encoded, most printable
characters in the ASCII range remain unchanged.
QP uses an escape notation of the form = xx, where xx are two hexadecimal digits, for
representing non-ASCII characters as well as some ASCII characters. The digits xx in-
dicate the numeric value of the octet. The escape notation must be applied even to
many ASCII characters (all code values are expressed here in hexadecimal):
• Most control characters must be escaped. For example, the ASCII form feed, ...