Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MIME::QuotedPrint

Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.

Provides quoted-printable encoding and decoding functions compatible with Perl’s MIME::QuotedPrint module (part of MIME::Base64 distribution). Since PetaPerl does not support XS, this module is implemented directly in Rust.

Functions

decode_qp

Decode a quoted-printable encoded string back to the original data. Soft line breaks (=\n) are removed, =XX sequences are decoded, and trailing whitespace before newlines is stripped.

use MIME::QuotedPrint;
my $decoded = decode_qp($encoded);

encode_qp

Encode a string using quoted-printable encoding (RFC 2045). Non-printable and high-bit characters are represented as =XX. An optional second argument specifies the EOL sequence for soft line breaks (default: “\n”). An optional third argument enables binary mode, encoding CR and LF as =0D and =0A.

use MIME::QuotedPrint;
my $encoded = encode_qp("Hello =World");
my $binary  = encode_qp($data, "\n", 1);