⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quotedprint.html

📁 perl教程
💻 HTML
字号:
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>MIME::QuotedPrint - Encoding and decoding of quoted-printable strings</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
 <span class="keyword">use</span> <span class="variable">MIME::QuotedPrint</span><span class="operator">;</span>
</pre>
<pre>
 <span class="variable">$encoded</span> <span class="operator">=</span> <span class="variable">encode_qp</span><span class="operator">(</span><span class="variable">$decoded</span><span class="operator">);</span>
 <span class="variable">$decoded</span> <span class="operator">=</span> <span class="variable">decode_qp</span><span class="operator">(</span><span class="variable">$encoded</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This module provides functions to encode and decode strings into and from the
quoted-printable encoding specified in RFC 2045 - <em>MIME (Multipurpose
Internet Mail Extensions)</em>.  The quoted-printable encoding is intended
to represent data that largely consists of bytes that correspond to
printable characters in the ASCII character set.  Each non-printable
character (as defined by English Americans) is represented by a
triplet consisting of the character &quot;=&quot; followed by two hexadecimal
digits.</p>
<p>The following functions are provided:</p>
<dl>
<dt><strong><a name="item_encode_qp"><code>encode_qp($str)</code></a></strong>

<dt><strong>encode_qp($str, $eol)</strong>

<dt><strong>encode_qp($str, $eol, $binmode)</strong>

<dd>
<p>This function returns an encoded version of the string ($str) given as
argument.</p>
</dd>
<dd>
<p>The second argument ($eol) is the line-ending sequence to use.  It is
optional and defaults to &quot;\n&quot;.  Every occurrence of &quot;\n&quot; is replaced
with this string, and it is also used for additional &quot;soft line
breaks&quot; to ensure that no line end up longer than 76 characters.  Pass
it as &quot;\015\012&quot; to produce data suitable for external consumption.
The string &quot;\r\n&quot; produces the same result on many platforms, but not
all.</p>
</dd>
<dd>
<p>The third argument ($binmode) will select binary mode if passed as a
TRUE value.  In binary mode &quot;\n&quot; will be encoded in the same way as
any other non-printable character.  This ensures that a decoder will
end up with exactly the same string whatever line ending sequence it
uses.  In general it is preferable to use the base64 encoding for
binary data; see <a href="../../lib/MIME/Base64.html">the MIME::Base64 manpage</a>.</p>
</dd>
<dd>
<p>An $eol of &quot;&quot; (the empty string) is special.  In this case, no &quot;soft
line breaks&quot; are introduced and binary mode is effectively enabled so
that any &quot;\n&quot; in the original data is encoded as well.</p>
</dd>
</li>
<dt><strong><a name="item_decode_qp">decode_qp($str);</a></strong>

<dd>
<p>This function returns the plain text version of the string given
as argument.  The lines of the result are &quot;\n&quot; terminated, even if
the $str argument contains &quot;\r\n&quot; terminated lines.</p>
</dd>
</li>
</dl>
<p>If you prefer not to import these routines into your namespace, you can
call them as:</p>
<pre>
  <span class="keyword">use</span> <span class="variable">MIME::QuotedPrint</span> <span class="operator">();</span>
  <span class="variable">$encoded</span> <span class="operator">=</span> <span class="variable">MIME::QuotedPrint::encode</span><span class="operator">(</span><span class="variable">$decoded</span><span class="operator">);</span>
  <span class="variable">$decoded</span> <span class="operator">=</span> <span class="variable">MIME::QuotedPrint::decode</span><span class="operator">(</span><span class="variable">$encoded</span><span class="operator">);</span>
</pre>
<p>Perl v5.8 and better allow extended Unicode characters in strings.
Such strings cannot be encoded directly, as the quoted-printable
encoding is only defined for single-byte characters.  The solution is
to use the Encode module to select the byte encoding you want.  For
example:</p>
<pre>
    <span class="keyword">use</span> <span class="variable">MIME::QuotedPrint</span> <span class="string">qw(encode_qp)</span><span class="operator">;</span>
    <span class="keyword">use</span> <span class="variable">Encode</span> <span class="string">qw(encode)</span><span class="operator">;</span>
</pre>
<pre>
    <span class="variable">$encoded</span> <span class="operator">=</span> <span class="variable">encode_qp</span><span class="operator">(</span><span class="variable">encode</span><span class="operator">(</span><span class="string">"UTF-8"</span><span class="operator">,</span> <span class="string">"\x{FFFF}\n"</span><span class="operator">));</span>
    <span class="keyword">print</span> <span class="variable">$encoded</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 1995-1997,2002-2004 Gisle Aas.</p>
<p>This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="../../lib/MIME/Base64.html">the MIME::Base64 manpage</a></p>

</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -