Quoted-Printable Codificación Reglas
RFC 2045 Quoted-Printable codificación para transmitting 8-bit texto sobre 7-bit channels.
Encoding Principles
Quoted-Printable encodes bytes so that mostly ASCII text remains human-readable while non-printable bytes are escaped. Printable ASCII characters except the equals sign are left as-is. Bytes outside the printable range or the equals sign are represented as an equals sign followed by two uppercase hex digits. This keeps the encoded form close to the original for text-heavy content, unlike Base64 which obscures everything.
- literal
- Printable ASCII (33-126 except 61) kept as-is
- =XX
- Equals plus two hex digits for non-printable bytes
- soft break
- Equals at end of line signals a soft line break
- space/tab
- Trailing whitespace must be encoded
Hello stays Hello =E9 for 0xE9 long line= wraps trailing space =20 Line Length Limits
Encoded lines must not exceed 76 characters, excluding the trailing CRLF. When a line would exceed this limit, a soft line break is inserted by placing an equals sign at the end. Decoders remove soft breaks to reconstruct the original byte stream. Hard line breaks in the original, represented as a literal CRLF, are preserved without an equals prefix.
Decoding Pitfalls
A decoder must handle malformed sequences gracefully, such as an equals sign not followed by two hex digits. Strict decoders reject malformed input, while lenient ones may pass the literal equals through. Trailing whitespace before a soft break must be encoded because mail gateways historically strip it. Failing to encode trailing whitespace causes silent data corruption in transit.