decode_qp#
Decode a quoted-printable string back to plain bytes.
Synopsis#
$decoded = decode_qp($encoded);
What you get back#
A scalar holding the decoded byte string. Every =XX triplet is
replaced by the byte whose hex value is XX; soft line breaks
(a = immediately before \r\n or \n) are removed.
Line terminators are normalized: whether the input used \n or
\r\n, each line in the result ends with \n.
Examples#
use MIME::QuotedPrint;
print decode_qp("Hello, world!\n"); # Hello, world!\n
print decode_qp("caf=E9\n"); # café (Latin-1 byte E9)
print decode_qp("line =\r\ncontinued"); # line continued
print decode_qp("=00=01=02"); # three bytes: 00 01 02
Edge cases#
A stray
=not followed by two hex digits or a line break is passed through literally, matching the upstream decoder.Trailing whitespace on a decoded line is stripped, matching the encoder’s soft-break contract.
Lowercase hex digits are accepted even though the encoder only emits uppercase.
Differences from upstream#
Fully compatible with upstream MIME::QuotedPrint 3.16.
See also#
encode_qp— produce the encoded form.MIME::Base64::decode_base64— the counterpart for binary payloads.