mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Correct the quopri module documentation. Mention the correct types of the
parameters on encodestring and decodestring. Patch by Petri Lehtinen.
This commit is contained in:
parent
ab960f838c
commit
99597c4d12
2 changed files with 22 additions and 24 deletions
|
@ -24,9 +24,8 @@ sending a graphics file.
|
|||
.. function:: decode(input, output, header=False)
|
||||
|
||||
Decode the contents of the *input* file and write the resulting decoded binary
|
||||
data to the *output* file. *input* and *output* must be :term:`file objects
|
||||
<file object>`. *input* will be read until ``input.readline()`` returns an
|
||||
empty string. If the optional argument *header* is present and true, underscore
|
||||
data to the *output* file. *input* and *output* must be :term:`binary file objects
|
||||
<file object>`. If the optional argument *header* is present and true, underscore
|
||||
will be decoded as space. This is used to decode "Q"-encoded headers as
|
||||
described in :rfc:`1522`: "MIME (Multipurpose Internet Mail Extensions)
|
||||
Part Two: Message Header Extensions for Non-ASCII Text".
|
||||
|
@ -34,27 +33,28 @@ sending a graphics file.
|
|||
|
||||
.. function:: encode(input, output, quotetabs, header=False)
|
||||
|
||||
Encode the contents of the *input* file and write the resulting quoted-printable
|
||||
data to the *output* file. *input* and *output* must be :term:`file objects
|
||||
<file object>`. *input* will be read until ``input.readline()`` returns an
|
||||
empty string. *quotetabs* is a 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 :rfc:`1521`. *header* is a flag
|
||||
which controls if spaces are encoded as underscores as per :rfc:`1522`.
|
||||
Encode the contents of the *input* file and write the resulting quoted-
|
||||
printable data to the *output* file. *input* and *output* must be
|
||||
:term:`binary file objects <file object>`. *quotetabs*, a flag which controls
|
||||
whether to encode embedded spaces and tabs must be provideda and 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 :rfc:`1521`. *header* is a flag which controls if spaces are encoded
|
||||
as underscores as per :rfc:`1522`.
|
||||
|
||||
|
||||
.. function:: decodestring(s, header=False)
|
||||
|
||||
Like :func:`decode`, except that it accepts a source string and returns the
|
||||
corresponding decoded string.
|
||||
Like :func:`decode`, except that it accepts a source :class:`bytes` and
|
||||
returns the corresponding decoded :class:`bytes`.
|
||||
|
||||
|
||||
.. function:: encodestring(s, quotetabs=False, header=False)
|
||||
|
||||
Like :func:`encode`, except that it accepts a source string and returns the
|
||||
corresponding encoded string. *quotetabs* and *header* are optional
|
||||
(defaulting to ``False``), and are passed straight through to :func:`encode`.
|
||||
Like :func:`encode`, except that it accepts a source :class:`bytes` and
|
||||
returns the corresponding encoded :class:`bytes`. By default, it sends a
|
||||
False value to *quotetabs* parameter of the :func:`encode` function.
|
||||
|
||||
|
||||
|
||||
.. seealso::
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue