MIME::QuotedPrint#
Native implementation of MIME::QuotedPrint
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#
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);
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);
Quoted-Printable Encoding Rules (RFC 2045)#
Non-printable chars (0x00-0x1F except tab 0x09, and 0x7F-0xFF) become
=XX=always encodes as=3DLines must not exceed 76 characters; soft breaks
=\nare insertedTrailing whitespace before EOL must be encoded (
=20,=09)$eolparameter (default"\n"): replaces\nin output for soft breaks$eol = ""means no soft breaks (binary mode for line breaks)$binmode = true: encode\nas=0A,\ras=0D