aboutsummaryrefslogtreecommitdiff
path: root/doc/mime.html
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2022-03-22 19:21:58 +0100
committerGitHub <noreply@github.com>2022-03-22 21:21:58 +0300
commitf97dc8489d58aef2d038288f9a8bc69f907e17bb (patch)
tree3ac503f8ed1cc44b1c16528ed80347b0a5590cc7 /doc/mime.html
parentd3434c01983de3ec40e4535f856081ad138fa198 (diff)
downloadluasocket-f97dc8489d58aef2d038288f9a8bc69f907e17bb.tar.gz
luasocket-f97dc8489d58aef2d038288f9a8bc69f907e17bb.tar.bz2
luasocket-f97dc8489d58aef2d038288f9a8bc69f907e17bb.zip
fix(docs) fix html linter issues in the docs (#358)
Diffstat (limited to 'doc/mime.html')
-rw-r--r--doc/mime.html302
1 files changed, 151 insertions, 151 deletions
diff --git a/doc/mime.html b/doc/mime.html
index 8cb3507..ff4d8e8 100644
--- a/doc/mime.html
+++ b/doc/mime.html
@@ -1,10 +1,10 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd"> 2 "http://www.w3.org/TR/html4/strict.dtd">
3<html> 3<html>
4 4
5<head> 5<head>
6<meta name="description" content="LuaSocket: MIME support"> 6<meta name="description" content="LuaSocket: MIME support">
7<meta name="keywords" content="Lua, LuaSocket, MIME, Library, Support"> 7<meta name="keywords" content="Lua, LuaSocket, MIME, Library, Support">
8<title>LuaSocket: MIME module</title> 8<title>LuaSocket: MIME module</title>
9<link rel="stylesheet" href="reference.css" type="text/css"> 9<link rel="stylesheet" href="reference.css" type="text/css">
10</head> 10</head>
@@ -13,22 +13,22 @@
13 13
14<!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 14<!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
15 15
16<div class=header> 16<div class="header">
17<hr> 17<hr>
18<center> 18<center>
19<table summary="LuaSocket logo"> 19<table summary="LuaSocket logo">
20<tr><td align=center><a href="http://www.lua.org"> 20<tr><td align="center"><a href="http://www.lua.org">
21<img width=128 height=128 border=0 alt="LuaSocket" src="luasocket.png"> 21<img width="128" height="128" border="0" alt="LuaSocket" src="luasocket.png">
22</a></td></tr> 22</a></td></tr>
23<tr><td align=center valign=top>Network support for the Lua language 23<tr><td align="center" valign="top">Network support for the Lua language
24</td></tr> 24</td></tr>
25</table> 25</table>
26<p class=bar> 26<p class="bar">
27<a href="index.html">home</a> &middot; 27<a href="index.html">home</a> &middot;
28<a href="index.html#download">download</a> &middot; 28<a href="index.html#download">download</a> &middot;
29<a href="installation.html">installation</a> &middot; 29<a href="installation.html">installation</a> &middot;
30<a href="introduction.html">introduction</a> &middot; 30<a href="introduction.html">introduction</a> &middot;
31<a href="reference.html">reference</a> 31<a href="reference.html">reference</a>
32</p> 32</p>
33</center> 33</center>
34<hr> 34<hr>
@@ -36,14 +36,14 @@
36 36
37<!-- mime +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 37<!-- mime +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
38 38
39<h2 id=mime>MIME</h2> 39<h2 id="mime">MIME</h2>
40 40
41<p> 41<p>
42The <tt>mime</tt> namespace offers filters that apply and remove common 42The <tt>mime</tt> namespace offers filters that apply and remove common
43content transfer encodings, such as Base64 and Quoted-Printable. 43content transfer encodings, such as Base64 and Quoted-Printable.
44It also provides functions to break text into lines and change 44It also provides functions to break text into lines and change
45the end-of-line convention. 45the end-of-line convention.
46MIME is described mainly in 46MIME is described mainly in
47<a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>, 47<a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>,
48<a href="http://www.ietf.org/rfc/rfc2046.txt">2046</a>, 48<a href="http://www.ietf.org/rfc/rfc2046.txt">2046</a>,
49<a href="http://www.ietf.org/rfc/rfc2047.txt">2047</a>, 49<a href="http://www.ietf.org/rfc/rfc2047.txt">2047</a>,
@@ -52,17 +52,17 @@ MIME is described mainly in
52</p> 52</p>
53 53
54<p> 54<p>
55All functionality provided by the MIME module 55All functionality provided by the MIME module
56follows the ideas presented in 56follows the ideas presented in
57<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks"> 57<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">
58LTN012, Filters sources and sinks</a>. 58LTN012, Filters sources and sinks</a>.
59</p> 59</p>
60 60
61<p> 61<p>
62To obtain the <tt>mime</tt> namespace, run: 62To obtain the <tt>mime</tt> namespace, run:
63</p> 63</p>
64 64
65<pre class=example> 65<pre class="example">
66-- loads the MIME module and everything it requires 66-- loads the MIME module and everything it requires
67local mime = require("mime") 67local mime = require("mime")
68</pre> 68</pre>
@@ -70,60 +70,60 @@ local mime = require("mime")
70 70
71<!-- High-level +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 71<!-- High-level +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
72 72
73<h3 id=high>High-level filters</h3> 73<h3 id="high">High-level filters</h3>
74 74
75 75
76<!-- decode +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 76<!-- decode +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
77 77
78<p class=name id="decode"> 78<p class="name" id="decode">
79mime.<b>decode(</b>"base64"<b>)</b><br> 79mime.<b>decode(</b>"base64"<b>)</b><br>
80mime.<b>decode(</b>"quoted-printable"<b>)</b> 80mime.<b>decode(</b>"quoted-printable"<b>)</b>
81</p> 81</p>
82 82
83<p class=description> 83<p class="description">
84Returns a filter that decodes data from a given transfer content 84Returns a filter that decodes data from a given transfer content
85encoding. 85encoding.
86</p> 86</p>
87 87
88<!-- encode +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 88<!-- encode +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
89 89
90<p class=name id="encode"> 90<p class="name" id="encode">
91mime.<b>encode(</b>"base64"<b>)</b><br> 91mime.<b>encode(</b>"base64"<b>)</b><br>
92mime.<b>encode(</b>"quoted-printable" [, mode]<b>)</b> 92mime.<b>encode(</b>"quoted-printable" [, mode]<b>)</b>
93</p> 93</p>
94 94
95<p class=description> 95<p class="description">
96Returns a filter that encodes data according to a given transfer content 96Returns a filter that encodes data according to a given transfer content
97encoding. 97encoding.
98</p> 98</p>
99 99
100<p class=parameters> 100<p class="parameters">
101In the Quoted-Printable case, the user can specify whether the data is 101In the Quoted-Printable case, the user can specify whether the data is
102textual or binary, by passing the <tt>mode</tt> strings "<tt>text</tt>" or 102textual or binary, by passing the <tt>mode</tt> strings "<tt>text</tt>" or
103"<tt>binary</tt>". <tt>Mode</tt> defaults to "<tt>text</tt>". 103"<tt>binary</tt>". <tt>Mode</tt> defaults to "<tt>text</tt>".
104</p> 104</p>
105 105
106<p class=note> 106<p class="note">
107Although both transfer content encodings specify a limit for the line 107Although both transfer content encodings specify a limit for the line
108length, the encoding filters do <em>not</em> break text into lines (for 108length, the encoding filters do <em>not</em> break text into lines (for
109added flexibility). 109added flexibility).
110Below is a filter that converts binary data to the Base64 transfer content 110Below is a filter that converts binary data to the Base64 transfer content
111encoding and breaks it into lines of the correct size. 111encoding and breaks it into lines of the correct size.
112</p> 112</p>
113 113
114<pre class=example> 114<pre class="example">
115base64 = ltn12.filter.chain( 115base64 = ltn12.filter.chain(
116 mime.encode("base64"), 116 mime.encode("base64"),
117 mime.wrap("base64") 117 mime.wrap("base64")
118) 118)
119</pre> 119</pre>
120 120
121<p class=note> 121<p class="note">
122Note: Text data <em>has</em> to be converted to canonic form 122Note: Text data <em>has</em> to be converted to canonic form
123<em>before</em> being encoded. 123<em>before</em> being encoded.
124</p> 124</p>
125 125
126<pre class=example> 126<pre class="example">
127base64 = ltn12.filter.chain( 127base64 = ltn12.filter.chain(
128 mime.normalize(), 128 mime.normalize(),
129 mime.encode("base64"), 129 mime.encode("base64"),
@@ -133,77 +133,77 @@ base64 = ltn12.filter.chain(
133 133
134<!-- normalize ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 134<!-- normalize ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
135 135
136<p class=name id="normalize"> 136<p class="name" id="normalize">
137mime.<b>normalize(</b>[marker]<b>)</b> 137mime.<b>normalize(</b>[marker]<b>)</b>
138</p> 138</p>
139 139
140<p class=description> 140<p class="description">
141Converts most common end-of-line markers to a specific given marker. 141Converts most common end-of-line markers to a specific given marker.
142</p> 142</p>
143 143
144<p class=parameters> 144<p class="parameters">
145<tt>Marker</tt> is the new marker. It defaults to CRLF, the canonic 145<tt>Marker</tt> is the new marker. It defaults to CRLF, the canonic
146end-of-line marker defined by the MIME standard. 146end-of-line marker defined by the MIME standard.
147</p> 147</p>
148 148
149<p class=return> 149<p class="return">
150The function returns a filter that performs the conversion. 150The function returns a filter that performs the conversion.
151</p> 151</p>
152 152
153<p class=note> 153<p class="note">
154Note: There is no perfect solution to this problem. Different end-of-line 154Note: There is no perfect solution to this problem. Different end-of-line
155markers are an evil that will probably plague developers forever. 155markers are an evil that will probably plague developers forever.
156This function, however, will work perfectly for text created with any of 156This function, however, will work perfectly for text created with any of
157the most common end-of-line markers, i.e. the Mac OS (CR), the Unix (LF), 157the most common end-of-line markers, i.e. the Mac OS (CR), the Unix (LF),
158or the DOS (CRLF) conventions. Even if the data has mixed end-of-line 158or the DOS (CRLF) conventions. Even if the data has mixed end-of-line
159markers, the function will still work well, although it doesn't 159markers, the function will still work well, although it doesn't
160guarantee that the number of empty lines will be correct. 160guarantee that the number of empty lines will be correct.
161</p> 161</p>
162 162
163<!-- stuff +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 163<!-- stuff +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
164 164
165<p class=name id="stuff"> 165<p class="name" id="stuff">
166mime.<b>stuff()</b><br> 166mime.<b>stuff()</b><br>
167</p> 167</p>
168 168
169<p class=description> 169<p class="description">
170Creates and returns a filter that performs stuffing of SMTP messages. 170Creates and returns a filter that performs stuffing of SMTP messages.
171</p> 171</p>
172 172
173<p class=note> 173<p class="note">
174Note: The <a href=smtp.html#send><tt>smtp.send</tt></a> function 174Note: The <a href="smtp.html#send"><tt>smtp.send</tt></a> function
175uses this filter automatically. You don't need to chain it with your 175uses this filter automatically. You don't need to chain it with your
176source, or apply it to your message body. 176source, or apply it to your message body.
177</p> 177</p>
178 178
179<!-- wrap +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 179<!-- wrap +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
180 180
181<p class=name id="wrap"> 181<p class="name" id="wrap">
182mime.<b>wrap(</b>"text" [, length]<b>)</b><br> 182mime.<b>wrap(</b>"text" [, length]<b>)</b><br>
183mime.<b>wrap(</b>"base64"<b>)</b><br> 183mime.<b>wrap(</b>"base64"<b>)</b><br>
184mime.<b>wrap(</b>"quoted-printable"<b>)</b> 184mime.<b>wrap(</b>"quoted-printable"<b>)</b>
185</p> 185</p>
186 186
187<p class=description> 187<p class="description">
188Returns a filter that breaks data into lines. 188Returns a filter that breaks data into lines.
189</p> 189</p>
190 190
191<p class=parameters> 191<p class="parameters">
192The "<tt>text</tt>" line-wrap filter simply breaks text into lines by 192The "<tt>text</tt>" line-wrap filter simply breaks text into lines by
193inserting CRLF end-of-line markers at appropriate positions. 193inserting CRLF end-of-line markers at appropriate positions.
194<tt>Length</tt> defaults 76. 194<tt>Length</tt> defaults 76.
195The "<tt>base64</tt>" line-wrap filter works just like the default 195The "<tt>base64</tt>" line-wrap filter works just like the default
196"<tt>text</tt>" line-wrap filter with default length. 196"<tt>text</tt>" line-wrap filter with default length.
197The function can also wrap "<tt>quoted-printable</tt>" lines, taking care 197The function can also wrap "<tt>quoted-printable</tt>" lines, taking care
198not to break lines in the middle of an escaped character. In that case, the 198not to break lines in the middle of an escaped character. In that case, the
199line length is fixed at 76. 199line length is fixed at 76.
200</p> 200</p>
201 201
202<p class=note> 202<p class="note">
203For example, to create an encoding filter for the Quoted-Printable transfer content encoding of text data, do the following: 203For example, to create an encoding filter for the Quoted-Printable transfer content encoding of text data, do the following:
204</p> 204</p>
205 205
206<pre class=example> 206<pre class="example">
207qp = ltn12.filter.chain( 207qp = ltn12.filter.chain(
208 mime.normalize(), 208 mime.normalize(),
209 mime.encode("quoted-printable"), 209 mime.encode("quoted-printable"),
@@ -211,155 +211,155 @@ qp = ltn12.filter.chain(
211) 211)
212</pre> 212</pre>
213 213
214<p class=note> 214<p class="note">
215Note: To break into lines with a different end-of-line convention, apply 215Note: To break into lines with a different end-of-line convention, apply
216a normalization filter after the line break filter. 216a normalization filter after the line break filter.
217</p> 217</p>
218 218
219<!-- Low-level ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 219<!-- Low-level ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
220 220
221<h3 id=low>Low-level filters</h3> 221<h3 id="low">Low-level filters</h3>
222 222
223<!-- b64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 223<!-- b64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
224 224
225<p class=name id="b64"> 225<p class="name" id="b64">
226A, B = mime.<b>b64(</b>C [, D]<b>)</b> 226A, B = mime.<b>b64(</b>C [, D]<b>)</b>
227</p> 227</p>
228 228
229<p class=description> 229<p class="description">
230Low-level filter to perform Base64 encoding. 230Low-level filter to perform Base64 encoding.
231</p> 231</p>
232 232
233<p class=description> 233<p class="description">
234<tt>A</tt> is the encoded version of the largest prefix of 234<tt>A</tt> is the encoded version of the largest prefix of
235<tt>C..D</tt> 235<tt>C..D</tt>
236that can be encoded unambiguously. <tt>B</tt> has the remaining bytes of 236that can be encoded unambiguously. <tt>B</tt> has the remaining bytes of
237<tt>C..D</tt>, <em>before</em> encoding. 237<tt>C..D</tt>, <em>before</em> encoding.
238If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is padded with 238If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is padded with
239the encoding of the remaining bytes of <tt>C</tt>. 239the encoding of the remaining bytes of <tt>C</tt>.
240</p> 240</p>
241 241
242<p class=note> 242<p class="note">
243Note: The simplest use of this function is to encode a string into it's 243Note: The simplest use of this function is to encode a string into it's
244Base64 transfer content encoding. Notice the extra parenthesis around the 244Base64 transfer content encoding. Notice the extra parenthesis around the
245call to <tt>mime.b64</tt>, to discard the second return value. 245call to <tt>mime.b64</tt>, to discard the second return value.
246</p> 246</p>
247 247
248<pre class=example> 248<pre class="example">
249print((mime.b64("diego:password"))) 249print((mime.b64("diego:password")))
250--&gt; ZGllZ286cGFzc3dvcmQ= 250--&gt; ZGllZ286cGFzc3dvcmQ=
251</pre> 251</pre>
252 252
253<!-- dot +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 253<!-- dot +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
254<p class=name id="dot"> 254<p class="name" id="dot">
255A, n = mime.<b>dot(</b>m [, B]<b>)</b> 255A, n = mime.<b>dot(</b>m [, B]<b>)</b>
256</p> 256</p>
257 257
258<p class=description> 258<p class="description">
259Low-level filter to perform SMTP stuffing and enable transmission of 259Low-level filter to perform SMTP stuffing and enable transmission of
260messages containing the sequence "CRLF.CRLF". 260messages containing the sequence "CRLF.CRLF".
261</p> 261</p>
262 262
263<p class=parameters> 263<p class="parameters">
264<tt>A</tt> is the stuffed version of <tt>B</tt>. '<tt>n</tt>' gives the 264<tt>A</tt> is the stuffed version of <tt>B</tt>. '<tt>n</tt>' gives the
265number of characters from the sequence CRLF seen in the end of <tt>B</tt>. 265number of characters from the sequence CRLF seen in the end of <tt>B</tt>.
266'<tt>m</tt>' should tell the same, but for the previous chunk. 266'<tt>m</tt>' should tell the same, but for the previous chunk.
267</p> 267</p>
268 268
269<p class=note>Note: The message body is defined to begin with 269<p class="note">Note: The message body is defined to begin with
270an implicit CRLF. Therefore, to stuff a message correctly, the 270an implicit CRLF. Therefore, to stuff a message correctly, the
271first <tt>m</tt> should have the value 2. 271first <tt>m</tt> should have the value 2.
272</p> 272</p>
273 273
274<pre class=example> 274<pre class="example">
275print((string.gsub(mime.dot(2, ".\r\nStuffing the message.\r\n.\r\n."), "\r\n", "\\n"))) 275print((string.gsub(mime.dot(2, ".\r\nStuffing the message.\r\n.\r\n."), "\r\n", "\\n")))
276--&gt; ..\nStuffing the message.\n..\n.. 276--&gt; ..\nStuffing the message.\n..\n..
277</pre> 277</pre>
278 278
279<p class=note> 279<p class="note">
280Note: The <a href=smtp.html#send><tt>smtp.send</tt></a> function 280Note: The <a href="smtp.html#send"><tt>smtp.send</tt></a> function
281uses this filter automatically. You don't need to 281uses this filter automatically. You don't need to
282apply it again. 282apply it again.
283</p> 283</p>
284 284
285<!-- eol ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 285<!-- eol ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
286 286
287<p class=name id="eol"> 287<p class="name" id="eol">
288A, B = mime.<b>eol(</b>C [, D, marker]<b>)</b> 288A, B = mime.<b>eol(</b>C [, D, marker]<b>)</b>
289</p> 289</p>
290 290
291<p class=description> 291<p class="description">
292Low-level filter to perform end-of-line marker translation. 292Low-level filter to perform end-of-line marker translation.
293For each chunk, the function needs to know if the last character of the 293For each chunk, the function needs to know if the last character of the
294previous chunk could be part of an end-of-line marker or not. This is the 294previous chunk could be part of an end-of-line marker or not. This is the
295context the function receives besides the chunk. An updated version of 295context the function receives besides the chunk. An updated version of
296the context is returned after each new chunk. 296the context is returned after each new chunk.
297</p> 297</p>
298 298
299<p class=parameters> 299<p class="parameters">
300<tt>A</tt> is the translated version of <tt>D</tt>. <tt>C</tt> is the 300<tt>A</tt> is the translated version of <tt>D</tt>. <tt>C</tt> is the
301ASCII value of the last character of the previous chunk, if it was a 301ASCII value of the last character of the previous chunk, if it was a
302candidate for line break, or 0 otherwise. 302candidate for line break, or 0 otherwise.
303<tt>B</tt> is the same as <tt>C</tt>, but for the current 303<tt>B</tt> is the same as <tt>C</tt>, but for the current
304chunk. <tt>Marker</tt> gives the new end-of-line marker and defaults to CRLF. 304chunk. <tt>Marker</tt> gives the new end-of-line marker and defaults to CRLF.
305</p> 305</p>
306 306
307<pre class=example> 307<pre class="example">
308-- translates the end-of-line marker to UNIX 308-- translates the end-of-line marker to UNIX
309unix = mime.eol(0, dos, "\n") 309unix = mime.eol(0, dos, "\n")
310</pre> 310</pre>
311 311
312<!-- qp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 312<!-- qp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
313 313
314<p class=name id="qp"> 314<p class="name" id="qp">
315A, B = mime.<b>qp(</b>C [, D, marker]<b>)</b> 315A, B = mime.<b>qp(</b>C [, D, marker]<b>)</b>
316</p> 316</p>
317 317
318<p class=description> 318<p class="description">
319Low-level filter to perform Quoted-Printable encoding. 319Low-level filter to perform Quoted-Printable encoding.
320</p> 320</p>
321 321
322<p class=parameters> 322<p class="parameters">
323<tt>A</tt> is the encoded version of the largest prefix of 323<tt>A</tt> is the encoded version of the largest prefix of
324<tt>C..D</tt> 324<tt>C..D</tt>
325that can be encoded unambiguously. <tt>B</tt> has the remaining bytes of 325that can be encoded unambiguously. <tt>B</tt> has the remaining bytes of
326<tt>C..D</tt>, <em>before</em> encoding. 326<tt>C..D</tt>, <em>before</em> encoding.
327If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is padded with 327If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is padded with
328the encoding of the remaining bytes of <tt>C</tt>. 328the encoding of the remaining bytes of <tt>C</tt>.
329Throughout encoding, occurrences of CRLF are replaced by the 329Throughout encoding, occurrences of CRLF are replaced by the
330<tt>marker</tt>, which itself defaults to CRLF. 330<tt>marker</tt>, which itself defaults to CRLF.
331</p> 331</p>
332 332
333<p class=note> 333<p class="note">
334Note: The simplest use of this function is to encode a string into it's 334Note: The simplest use of this function is to encode a string into it's
335Quoted-Printable transfer content encoding. 335Quoted-Printable transfer content encoding.
336Notice the extra parenthesis around the call to <tt>mime.qp</tt>, to discard the second return value. 336Notice the extra parenthesis around the call to <tt>mime.qp</tt>, to discard the second return value.
337</p> 337</p>
338 338
339<pre class=example> 339<pre class="example">
340print((mime.qp("maçã"))) 340print((mime.qp("ma��")))
341--&gt; ma=E7=E3= 341--&gt; ma=E7=E3=
342</pre> 342</pre>
343 343
344<!-- qpwrp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 344<!-- qpwrp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
345 345
346<p class=name id="qpwrp"> 346<p class="name" id="qpwrp">
347A, m = mime.<b>qpwrp(</b>n [, B, length]<b>)</b> 347A, m = mime.<b>qpwrp(</b>n [, B, length]<b>)</b>
348</p> 348</p>
349 349
350<p class=description> 350<p class="description">
351Low-level filter to break Quoted-Printable text into lines. 351Low-level filter to break Quoted-Printable text into lines.
352</p> 352</p>
353 353
354<p class=parameters> 354<p class="parameters">
355<tt>A</tt> is a copy of <tt>B</tt>, broken into lines of at most 355<tt>A</tt> is a copy of <tt>B</tt>, broken into lines of at most
356<tt>length</tt> bytes (defaults to 76). 356<tt>length</tt> bytes (defaults to 76).
357'<tt>n</tt>' should tell how many bytes are left for the first 357'<tt>n</tt>' should tell how many bytes are left for the first
358line of <tt>B</tt> and '<tt>m</tt>' returns the number of bytes 358line of <tt>B</tt> and '<tt>m</tt>' returns the number of bytes
359left in the last line of <tt>A</tt>. 359left in the last line of <tt>A</tt>.
360</p> 360</p>
361 361
362<p class=note> 362<p class="note">
363Note: Besides breaking text into lines, this function makes sure the line 363Note: Besides breaking text into lines, this function makes sure the line
364breaks don't fall in the middle of an escaped character combination. Also, 364breaks don't fall in the middle of an escaped character combination. Also,
365this function only breaks lines that are bigger than <tt>length</tt> bytes. 365this function only breaks lines that are bigger than <tt>length</tt> bytes.
@@ -367,86 +367,86 @@ this function only breaks lines that are bigger than <tt>length</tt> bytes.
367 367
368<!-- unb64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 368<!-- unb64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
369 369
370<p class=name id="unb64"> 370<p class="name" id="unb64">
371A, B = mime.<b>unb64(</b>C [, D]<b>)</b> 371A, B = mime.<b>unb64(</b>C [, D]<b>)</b>
372</p> 372</p>
373 373
374<p class=description> 374<p class="description">
375Low-level filter to perform Base64 decoding. 375Low-level filter to perform Base64 decoding.
376</p> 376</p>
377 377
378<p class=parameters> 378<p class="parameters">
379<tt>A</tt> is the decoded version of the largest prefix of 379<tt>A</tt> is the decoded version of the largest prefix of
380<tt>C..D</tt> 380<tt>C..D</tt>
381that can be decoded unambiguously. <tt>B</tt> has the remaining bytes of 381that can be decoded unambiguously. <tt>B</tt> has the remaining bytes of
382<tt>C..D</tt>, <em>before</em> decoding. 382<tt>C..D</tt>, <em>before</em> decoding.
383If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is the empty string 383If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is the empty string
384and <tt>B</tt> returns whatever couldn't be decoded. 384and <tt>B</tt> returns whatever couldn't be decoded.
385</p> 385</p>
386 386
387<p class=note> 387<p class="note">
388Note: The simplest use of this function is to decode a string from it's 388Note: The simplest use of this function is to decode a string from it's
389Base64 transfer content encoding. 389Base64 transfer content encoding.
390Notice the extra parenthesis around the call to <tt>mime.unqp</tt>, to discard the second return value. 390Notice the extra parenthesis around the call to <tt>mime.unqp</tt>, to discard the second return value.
391</p> 391</p>
392 392
393<pre class=example> 393<pre class="example">
394print((mime.unb64("ZGllZ286cGFzc3dvcmQ="))) 394print((mime.unb64("ZGllZ286cGFzc3dvcmQ=")))
395--&gt; diego:password 395--&gt; diego:password
396</pre> 396</pre>
397 397
398<!-- unqp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 398<!-- unqp +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
399 399
400<p class=name id="unqp"> 400<p class="name" id="unqp">
401A, B = mime.<b>unqp(</b>C [, D]<b>)</b> 401A, B = mime.<b>unqp(</b>C [, D]<b>)</b>
402</p> 402</p>
403 403
404<p class=description> 404<p class="description">
405Low-level filter to remove the Quoted-Printable transfer content encoding 405Low-level filter to remove the Quoted-Printable transfer content encoding
406from data. 406from data.
407</p> 407</p>
408 408
409<p class=parameters> 409<p class="parameters">
410<tt>A</tt> is the decoded version of the largest prefix of 410<tt>A</tt> is the decoded version of the largest prefix of
411<tt>C..D</tt> 411<tt>C..D</tt>
412that can be decoded unambiguously. <tt>B</tt> has the remaining bytes of 412that can be decoded unambiguously. <tt>B</tt> has the remaining bytes of
413<tt>C..D</tt>, <em>before</em> decoding. 413<tt>C..D</tt>, <em>before</em> decoding.
414If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is augmented with 414If <tt>D</tt> is <tt><b>nil</b></tt>, <tt>A</tt> is augmented with
415the encoding of the remaining bytes of <tt>C</tt>. 415the encoding of the remaining bytes of <tt>C</tt>.
416</p> 416</p>
417 417
418<p class=note> 418<p class="note">
419Note: The simplest use of this function is to decode a string from it's 419Note: The simplest use of this function is to decode a string from it's
420Quoted-Printable transfer content encoding. 420Quoted-Printable transfer content encoding.
421Notice the extra parenthesis around the call to <tt>mime.unqp</tt>, to discard the second return value. 421Notice the extra parenthesis around the call to <tt>mime.unqp</tt>, to discard the second return value.
422</p> 422</p>
423 423
424<pre class=example> 424<pre class="example">
425print((mime.qp("ma=E7=E3="))) 425print((mime.qp("ma=E7=E3=")))
426--&gt; maçã 426--&gt; ma��
427</pre> 427</pre>
428 428
429<!-- wrp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 429<!-- wrp ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
430 430
431<p class=name id="wrp"> 431<p class="name" id="wrp">
432A, m = mime.<b>wrp(</b>n [, B, length]<b>)</b> 432A, m = mime.<b>wrp(</b>n [, B, length]<b>)</b>
433</p> 433</p>
434 434
435<p class=description> 435<p class="description">
436Low-level filter to break text into lines with CRLF marker. 436Low-level filter to break text into lines with CRLF marker.
437Text is assumed to be in the <a href=#normalize><tt>normalize</tt></a> form. 437Text is assumed to be in the <a href="#normalize"><tt>normalize</tt></a> form.
438</p> 438</p>
439 439
440<p class=parameters> 440<p class="parameters">
441<tt>A</tt> is a copy of <tt>B</tt>, broken into lines of at most 441<tt>A</tt> is a copy of <tt>B</tt>, broken into lines of at most
442<tt>length</tt> bytes (defaults to 76). 442<tt>length</tt> bytes (defaults to 76).
443'<tt>n</tt>' should tell how many bytes are left for the first 443'<tt>n</tt>' should tell how many bytes are left for the first
444line of <tt>B</tt> and '<tt>m</tt>' returns the number of bytes 444line of <tt>B</tt> and '<tt>m</tt>' returns the number of bytes
445left in the last line of <tt>A</tt>. 445left in the last line of <tt>A</tt>.
446</p> 446</p>
447 447
448<p class=note> 448<p class="note">
449Note: This function only breaks lines that are bigger than 449Note: This function only breaks lines that are bigger than
450<tt>length</tt> bytes. The resulting line length does not include the CRLF 450<tt>length</tt> bytes. The resulting line length does not include the CRLF
451marker. 451marker.
452</p> 452</p>
@@ -454,10 +454,10 @@ marker.
454 454
455<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 455<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
456 456
457<div class=footer> 457<div class="footer">
458<hr> 458<hr>
459<center> 459<center>
460<p class=bar> 460<p class="bar">
461<a href="index.html">home</a> &middot; 461<a href="index.html">home</a> &middot;
462<a href="index.html#down">download</a> &middot; 462<a href="index.html#down">download</a> &middot;
463<a href="installation.html">installation</a> &middot; 463<a href="installation.html">installation</a> &middot;