Install Perl 5.8.8
[msysgit.git] / mingw / html / ext / MIME / Base64 / QuotedPrint.html
blob440f2afcaf71959ac5ec6a2cbec3cd9c11826182
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 <li><a href="#copyright">COPYRIGHT</a></li>
26 <li><a href="#see_also">SEE ALSO</a></li>
27 </ul>
28 <!-- INDEX END -->
30 <hr />
31 <p>
32 </p>
33 <h1><a name="name">NAME</a></h1>
34 <p>MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</p>
35 <p>
36 </p>
37 <hr />
38 <h1><a name="synopsis">SYNOPSIS</a></h1>
39 <pre>
40 use MIME::QuotedPrint;</pre>
41 <pre>
42 $encoded = encode_qp($decoded);
43 $decoded = decode_qp($encoded);</pre>
44 <p>
45 </p>
46 <hr />
47 <h1><a name="description">DESCRIPTION</a></h1>
48 <p>This module provides functions to encode and decode strings into and from the
49 quoted-printable encoding specified in RFC 2045 - <em>MIME (Multipurpose
50 Internet Mail Extensions)</em>. The quoted-printable encoding is intended
51 to represent data that largely consists of bytes that correspond to
52 printable characters in the ASCII character set. Each non-printable
53 character (as defined by English Americans) is represented by a
54 triplet consisting of the character ``='' followed by two hexadecimal
55 digits.</p>
56 <p>The following functions are provided:</p>
57 <dl>
58 <dt><strong><a name="item_encode_qp"><code>encode_qp($str)</code></a></strong>
60 <dt><strong>encode_qp($str, $eol)</strong>
62 <dt><strong>encode_qp($str, $eol, $binmode)</strong>
64 <dd>
65 <p>This function returns an encoded version of the string ($str) given as
66 argument.</p>
67 </dd>
68 <dd>
69 <p>The second argument ($eol) is the line-ending sequence to use. It is
70 optional and defaults to ``\n''. Every occurrence of ``\n'' is replaced
71 with this string, and it is also used for additional ``soft line
72 breaks'' to ensure that no line end up longer than 76 characters. Pass
73 it as ``\015\012'' to produce data suitable for external consumption.
74 The string ``\r\n'' produces the same result on many platforms, but not
75 all.</p>
76 </dd>
77 <dd>
78 <p>The third argument ($binmode) will select binary mode if passed as a
79 TRUE value. In binary mode ``\n'' will be encoded in the same way as
80 any other non-printable character. This ensures that a decoder will
81 end up with exactly the same string whatever line ending sequence it
82 uses. In general it is preferable to use the base64 encoding for
83 binary data; see <a href="file://C|\msysgit\mingw\html/lib/MIME/Base64.html">the MIME::Base64 manpage</a>.</p>
84 </dd>
85 <dd>
86 <p>An $eol of ``'' (the empty string) is special. In this case, no ``soft
87 line breaks'' are introduced and binary mode is effectively enabled so
88 that any ``\n'' in the original data is encoded as well.</p>
89 </dd>
90 </li>
91 <dt><strong><a name="item_decode_qp">decode_qp($str);</a></strong>
93 <dd>
94 <p>This function returns the plain text version of the string given
95 as argument. The lines of the result are ``\n'' terminated, even if
96 the $str argument contains ``\r\n'' terminated lines.</p>
97 </dd>
98 </li>
99 </dl>
100 <p>If you prefer not to import these routines into your namespace, you can
101 call them as:</p>
102 <pre>
103 use MIME::QuotedPrint ();
104 $encoded = MIME::QuotedPrint::encode($decoded);
105 $decoded = MIME::QuotedPrint::decode($encoded);</pre>
106 <p>Perl v5.8 and better allow extended Unicode characters in strings.
107 Such strings cannot be encoded directly, as the quoted-printable
108 encoding is only defined for single-byte characters. The solution is
109 to use the Encode module to select the byte encoding you want. For
110 example:</p>
111 <pre>
112 use MIME::QuotedPrint qw(encode_qp);
113 use Encode qw(encode);</pre>
114 <pre>
115 $encoded = encode_qp(encode(&quot;UTF-8&quot;, &quot;\x{FFFF}\n&quot;));
116 print $encoded;</pre>
118 </p>
119 <hr />
120 <h1><a name="copyright">COPYRIGHT</a></h1>
121 <p>Copyright 1995-1997,2002-2004 Gisle Aas.</p>
122 <p>This library is free software; you can redistribute it and/or
123 modify it under the same terms as Perl itself.</p>
125 </p>
126 <hr />
127 <h1><a name="see_also">SEE ALSO</a></h1>
128 <p><a href="file://C|\msysgit\mingw\html/lib/MIME/Base64.html">the MIME::Base64 manpage</a></p>
129 <table border="0" width="100%" cellspacing="0" cellpadding="3">
130 <tr><td class="block" style="background-color: #cccccc" valign="middle">
131 <big><strong><span class="block">&nbsp;MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</span></strong></big>
132 </td></tr>
133 </table>
135 </body>
137 </html>