blob: 4079d2746cfe597401a25093d3ba0e22b5ca2f36 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{quopri} ---
Fred Drake180b68b1999-02-22 13:45:09 +00002 Encode and decode MIME quoted-printable data}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drake180b68b1999-02-22 13:45:09 +00004\declaremodule{standard}{quopri}
Fred Drake295da241998-08-10 19:42:37 +00005\modulesynopsis{Encode and decode files using the MIME
Fred Drakeffbe6871999-04-22 21:23:22 +00006 quoted-printable encoding.}
Fred Drakeb91e9341998-07-23 17:59:49 +00007
Guido van Rossume76b7a81997-04-27 21:25:52 +00008
9This module performs quoted-printable transport encoding and decoding,
Fred Drakec5891241998-02-09 19:16:20 +000010as defined in \rfc{1521}: ``MIME (Multipurpose Internet Mail Extensions)
Guido van Rossume76b7a81997-04-27 21:25:52 +000011Part One''. The quoted-printable encoding is designed for data where
Fred Draked59db4f1998-04-03 07:06:56 +000012there are relatively few nonprintable characters; the base64 encoding
Fred Drakeffbe6871999-04-22 21:23:22 +000013scheme available via the \refmodule{base64} module is more compact if there
Guido van Rossume76b7a81997-04-27 21:25:52 +000014are many such characters, as when sending a graphics file.
Fred Draked59db4f1998-04-03 07:06:56 +000015\indexii{quoted-printable}{encoding}
Guido van Rossume76b7a81997-04-27 21:25:52 +000016\index{MIME!quoted-printable encoding}
17
Fred Drake798654f1997-11-30 05:53:22 +000018
Fred Drakecce10901998-03-17 06:33:25 +000019\begin{funcdesc}{decode}{input, output}
Guido van Rossume76b7a81997-04-27 21:25:52 +000020Decode the contents of the \var{input} file and write the resulting
21decoded binary data to the \var{output} file.
22\var{input} and \var{output} must either be file objects or objects that
23mimic the file object interface. \var{input} will be read until
Barry Warsaw6016e392001-06-19 19:44:42 +000024\code{\var{input}.readline()} returns an empty string.
Guido van Rossume76b7a81997-04-27 21:25:52 +000025\end{funcdesc}
26
Fred Drakecce10901998-03-17 06:33:25 +000027\begin{funcdesc}{encode}{input, output, quotetabs}
Guido van Rossume76b7a81997-04-27 21:25:52 +000028Encode the contents of the \var{input} file and write the resulting
29quoted-printable data to the \var{output} file.
30\var{input} and \var{output} must either be file objects or objects that
31mimic the file object interface. \var{input} will be read until
Barry Warsaw6016e392001-06-19 19:44:42 +000032\code{\var{input}.readline()} returns an empty string.
33\var{quotetabs} is a flag which controls whether to encode embedded
34spaces and tabs; when true it encodes such embedded whitespace, and
35when false it leaves them unencoded. Note that spaces and tabs
36appearing at the end of lines are always encoded, as per \rfc{1521}.
37\end{funcdesc}
38
39\begin{funcdesc}{decodestring}{s}
40Like \function{decode()}, except that it accepts a source string and
41returns the corresponding decoded string.
42\end{funcdesc}
43
44\begin{funcdesc}{encodestring}{s\optional{, quotetabs}}
45Like \function{encode()}, except that it accepts a source string and
46returns the corresponding encoded string. \var{quotetabs} is optional
47(defaulting to 0), and is passed straight through to
48\function{encode()}.
Guido van Rossume76b7a81997-04-27 21:25:52 +000049\end{funcdesc}
50
51
Fred Drake12ed3652000-04-04 20:43:50 +000052\begin{seealso}
53 \seemodule{mimify}{General utilities for processing of MIME messages.}
Barry Warsaw6016e392001-06-19 19:44:42 +000054 \seemodule{base64}{Encode and decode MIME base64 data}
Fred Drake12ed3652000-04-04 20:43:50 +000055\end{seealso}