1QuotedPrint(3)        User Contributed Perl Documentation       QuotedPrint(3)
2
3
4

NAME

6       MIME::QuotedPrint - Encoding and decoding of quoted-printable strings
7

SYNOPSIS

9        use MIME::QuotedPrint;
10
11        $encoded = encode_qp($decoded);
12        $decoded = decode_qp($encoded);
13

DESCRIPTION

15       This module provides functions to encode and decode strings into and
16       from the quoted-printable encoding specified in RFC 2045 - MIME
17       (Multipurpose Internet Mail Extensions).  The quoted-printable encoding
18       is intended to represent data that largely consists of bytes that
19       correspond to printable characters in the ASCII character set.  Each
20       non-printable character (as defined by English Americans) is
21       represented by a triplet consisting of the character "=" followed by
22       two hexadecimal digits.
23
24       The following functions are provided:
25
26       encode_qp( $str)
27       encode_qp( $str, $eol)
28       encode_qp( $str, $eol, $binmode )
29           This function returns an encoded version of the string ($str) given
30           as argument.
31
32           The second argument ($eol) is the line-ending sequence to use.  It
33           is optional and defaults to "\n".  Every occurrence of "\n" is
34           replaced with this string, and it is also used for additional "soft
35           line breaks" to ensure that no line end up longer than 76
36           characters.  Pass it as "\015\012" to produce data suitable for
37           external consumption.  The string "\r\n" produces the same result
38           on many platforms, but not all.
39
40           The third argument ($binmode) will select binary mode if passed as
41           a TRUE value.  In binary mode "\n" will be encoded in the same way
42           as any other non-printable character.  This ensures that a decoder
43           will end up with exactly the same string whatever line ending
44           sequence it uses.  In general it is preferable to use the base64
45           encoding for binary data; see MIME::Base64.
46
47           An $eol of "" (the empty string) is special.  In this case, no
48           "soft line breaks" are introduced and binary mode is effectively
49           enabled so that any "\n" in the original data is encoded as well.
50
51       decode_qp( $str )
52           This function returns the plain text version of the string given as
53           argument.  The lines of the result are "\n" terminated, even if the
54           $str argument contains "\r\n" terminated lines.
55
56       If you prefer not to import these routines into your namespace, you can
57       call them as:
58
59         use MIME::QuotedPrint ();
60         $encoded = MIME::QuotedPrint::encode($decoded);
61         $decoded = MIME::QuotedPrint::decode($encoded);
62
63       Perl v5.8 and better allow extended Unicode characters in strings.
64       Such strings cannot be encoded directly, as the quoted-printable
65       encoding is only defined for single-byte characters.  The solution is
66       to use the Encode module to select the byte encoding you want.  For
67       example:
68
69           use MIME::QuotedPrint qw(encode_qp);
70           use Encode qw(encode);
71
72           $encoded = encode_qp(encode("UTF-8", "\x{FFFF}\n"));
73           print $encoded;
74
76       Copyright 1995-1997,2002-2004 Gisle Aas.
77
78       This library is free software; you can redistribute it and/or modify it
79       under the same terms as Perl itself.
80

SEE ALSO

82       MIME::Base64
83
84
85
86perl v5.30.0                      2019-07-26                    QuotedPrint(3)
Impressum