diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/python~3.12/library%2Fquopri.html | |
new repository
Diffstat (limited to 'devdocs/python~3.12/library%2Fquopri.html')
| -rw-r--r-- | devdocs/python~3.12/library%2Fquopri.html | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/devdocs/python~3.12/library%2Fquopri.html b/devdocs/python~3.12/library%2Fquopri.html new file mode 100644 index 00000000..71f52854 --- /dev/null +++ b/devdocs/python~3.12/library%2Fquopri.html @@ -0,0 +1,22 @@ + <span id="quopri-encode-and-decode-mime-quoted-printable-data"></span><h1>quopri — Encode and decode MIME quoted-printable data</h1> <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/quopri.py">Lib/quopri.py</a></p> <p>This module performs quoted-printable transport encoding and decoding, as defined in <span class="target" id="index-1"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc1521.html"><strong>RFC 1521</strong></a>: “MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies”. The quoted-printable encoding is designed for data where there are relatively few nonprintable characters; the base64 encoding scheme available via the <a class="reference internal" href="base64#module-base64" title="base64: RFC 4648: Base16, Base32, Base64 Data Encodings; Base85 and Ascii85"><code>base64</code></a> module is more compact if there are many such characters, as when sending a graphics file.</p> <dl class="py function"> <dt class="sig sig-object py" id="quopri.decode"> +<code>quopri.decode(input, output, header=False)</code> </dt> <dd> +<p>Decode the contents of the <em>input</em> file and write the resulting decoded binary data to the <em>output</em> file. <em>input</em> and <em>output</em> must be <a class="reference internal" href="../glossary#term-file-object"><span class="xref std std-term">binary file objects</span></a>. If the optional argument <em>header</em> is present and true, underscore will be decoded as space. This is used to decode “Q”-encoded headers as described in <span class="target" id="index-2"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc1522.html"><strong>RFC 1522</strong></a>: “MIME (Multipurpose Internet Mail Extensions) Part Two: Message Header Extensions for Non-ASCII Text”.</p> </dd> +</dl> <dl class="py function"> <dt class="sig sig-object py" id="quopri.encode"> +<code>quopri.encode(input, output, quotetabs, header=False)</code> </dt> <dd> +<p>Encode the contents of the <em>input</em> file and write the resulting quoted-printable data to the <em>output</em> file. <em>input</em> and <em>output</em> must be <a class="reference internal" href="../glossary#term-file-object"><span class="xref std std-term">binary file objects</span></a>. <em>quotetabs</em>, a non-optional flag which controls whether to encode embedded spaces and tabs; when true it encodes such embedded whitespace, and when false it leaves them unencoded. Note that spaces and tabs appearing at the end of lines are always encoded, as per <span class="target" id="index-3"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc1521.html"><strong>RFC 1521</strong></a>. <em>header</em> is a flag which controls if spaces are encoded as underscores as per <span class="target" id="index-4"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc1522.html"><strong>RFC 1522</strong></a>.</p> </dd> +</dl> <dl class="py function"> <dt class="sig sig-object py" id="quopri.decodestring"> +<code>quopri.decodestring(s, header=False)</code> </dt> <dd> +<p>Like <a class="reference internal" href="#quopri.decode" title="quopri.decode"><code>decode()</code></a>, except that it accepts a source <a class="reference internal" href="stdtypes#bytes" title="bytes"><code>bytes</code></a> and returns the corresponding decoded <a class="reference internal" href="stdtypes#bytes" title="bytes"><code>bytes</code></a>.</p> </dd> +</dl> <dl class="py function"> <dt class="sig sig-object py" id="quopri.encodestring"> +<code>quopri.encodestring(s, quotetabs=False, header=False)</code> </dt> <dd> +<p>Like <a class="reference internal" href="#quopri.encode" title="quopri.encode"><code>encode()</code></a>, except that it accepts a source <a class="reference internal" href="stdtypes#bytes" title="bytes"><code>bytes</code></a> and returns the corresponding encoded <a class="reference internal" href="stdtypes#bytes" title="bytes"><code>bytes</code></a>. By default, it sends a <code>False</code> value to <em>quotetabs</em> parameter of the <a class="reference internal" href="#quopri.encode" title="quopri.encode"><code>encode()</code></a> function.</p> </dd> +</dl> <div class="admonition seealso"> <p class="admonition-title">See also</p> <dl class="simple"> <dt> +<code>Module</code> <a class="reference internal" href="base64#module-base64" title="base64: RFC 4648: Base16, Base32, Base64 Data Encodings; Base85 and Ascii85"><code>base64</code></a> +</dt> +<dd> +<p>Encode and decode MIME base64 data</p> </dd> </dl> </div> <div class="_attribution"> + <p class="_attribution-p"> + © 2001–2023 Python Software Foundation<br>Licensed under the PSF License.<br> + <a href="https://docs.python.org/3.12/library/quopri.html" class="_attribution-link">https://docs.python.org/3.12/library/quopri.html</a> + </p> +</div> |
