跳到主要内容
uencoder

Quoted-Printable Encoding Rules

RFC 2045 Quoted-Printable 编码为 transmitting 8-位文本遍历 7-位 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
Hello stays Hello
=XX
Equals plus two hex digits for non-printable bytes
=E9 for 0xE9
soft break
Equals at end of line signals a soft line break
long line= wraps
space/tab
Trailing whitespace must be encoded
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.

相关工具

参考链接