Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
891e9e3b
Commit
891e9e3b
authored
Sep 12, 2019
by
Géry Ogam
Committed by
Carol Willing
Sep 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct typos in the codecs module documentation (#15135)
parent
39de95b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
60 deletions
+61
-60
Doc/library/codecs.rst
Doc/library/codecs.rst
+61
-60
No files found.
Doc/library/codecs.rst
View file @
891e9e3b
...
@@ -568,7 +568,7 @@ define in order to be compatible with the Python codec registry.
...
@@ -568,7 +568,7 @@ define in order to be compatible with the Python codec registry.
implementation should make sure that ``0`` is the most common
implementation should make sure that ``0`` is the most common
state. (States that are more complicated than integers can be converted
state. (States that are more complicated than integers can be converted
into an integer by marshaling/pickling the state and encoding the bytes
into an integer by marshaling/pickling the state and encoding the bytes
of the resulting string into an integer
).
of the resulting string into an integer
.)
.. method:: setstate(state)
.. method:: setstate(state)
...
@@ -780,8 +780,8 @@ compatible with the Python codec registry.
...
@@ -780,8 +780,8 @@ compatible with the Python codec registry.
Read all lines available on the input stream and return them as a list of
Read all lines available on the input stream and return them as a list of
lines.
lines.
Line-endings are implemented using the codec's
decoder method and are
Line-endings are implemented using the codec's
:meth:`decode` method and
included in the list entries if *keepends* is true.
are
included in the list entries if *keepends* is true.
*sizehint*, if given, is passed as the *size* argument to the stream's
*sizehint*, if given, is passed as the *size* argument to the stream's
:meth:`read` method.
:meth:`read` method.
...
@@ -841,7 +841,7 @@ The design is such that one can use the factory functions returned by the
...
@@ -841,7 +841,7 @@ The design is such that one can use the factory functions returned by the
code calling :meth:`read` and :meth:`write`, while *Reader* and *Writer*
code calling :meth:`read` and :meth:`write`, while *Reader* and *Writer*
work on the backend — the data in *stream*.
work on the backend — the data in *stream*.
You can use these objects to do transparent transcodings
from e.g.
Latin-1
You can use these objects to do transparent transcodings
, e.g., from
Latin-1
to UTF-8 and back.
to UTF-8 and back.
The *stream* argument must be a file-like object.
The *stream* argument must be a file-like object.
...
@@ -1145,7 +1145,7 @@ particular, the following variants typically exist:
...
@@ -1145,7 +1145,7 @@ particular, the following variants typically exist:
|
iso2022_kr | csiso2022kr, iso2022kr, | Korean |
|
iso2022_kr | csiso2022kr, iso2022kr, | Korean |
|
| iso-2022-kr | |
|
| iso-2022-kr | |
+-----------------+--------------------------------+--------------------------------+
+-----------------+--------------------------------+--------------------------------+
|
latin_1 | iso-8859-1, iso8859-1, 8859, | West
Europe
|
|
latin_1 | iso-8859-1, iso8859-1, 8859, | West
ern Europe
|
|
| cp819, latin, latin1, L1 | |
|
| cp819, latin, latin1, L1 | |
+-----------------+--------------------------------+--------------------------------+
+-----------------+--------------------------------+--------------------------------+
|
iso8859_2 | iso-8859-2, latin2, L2 | Central and Eastern Europe |
|
iso8859_2 | iso-8859-2, latin2, L2 | Central and Eastern Europe |
...
@@ -1254,7 +1254,7 @@ no meaning outside Python. These are listed in the tables below based on the
...
@@ -1254,7 +1254,7 @@ no meaning outside Python. These are listed in the tables below based on the
expected input and output types (note that while text encodings are the most
expected input and output types (note that while text encodings are the most
common use case for codecs, the underlying codec infrastructure supports
common use case for codecs, the underlying codec infrastructure supports
arbitrary data transforms rather than just text encodings). For asymmetric
arbitrary data transforms rather than just text encodings). For asymmetric
codecs, the stated
purpose
describes the encoding direction.
codecs, the stated
meaning
describes the encoding direction.
Text Encodings
Text Encodings
^^^^^^^^^^^^^^
^^^^^^^^^^^^^^
...
@@ -1266,27 +1266,27 @@ encodings.
...
@@ -1266,27 +1266,27 @@ encodings.
.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
|
Codec | Aliases |
Purpose
|
|
Codec | Aliases |
Meaning
|
+====================+=========+===========================+
+====================+=========+===========================+
|
idna | | Implement
s :rfc:`3490`,
|
|
idna | | Implement
:rfc:`3490`,
|
|
| | see also |
|
| | see also |
|
| | :mod:`encodings.idna`. |
|
| | :mod:`encodings.idna`. |
|
| | Only ``errors='strict'`` |
|
| | Only ``errors='strict'`` |
|
| | is supported. |
|
| | is supported. |
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
|
mbcs | ansi, | Windows only: Encode
|
|
mbcs | ansi, | Windows only: Encode
the
|
|
| dbcs | operand according to the |
|
| dbcs | operand according to the |
|
| | ANSI codepage (CP_ACP)
|
|
| | ANSI codepage (CP_ACP)
.
|
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
|
oem | | Windows only: Encode
|
|
oem | | Windows only: Encode
the
|
|
| | operand according to the |
|
| | operand according to the |
|
| | OEM codepage (CP_OEMCP)
|
|
| | OEM codepage (CP_OEMCP)
.
|
|
| | |
|
| | |
|
| | .. versionadded:: 3.6 |
|
| | .. versionadded:: 3.6 |
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
|
palmos | | Encoding of PalmOS 3.5
|
|
palmos | | Encoding of PalmOS 3.5
.
|
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
|
punycode | | Implement
s :rfc:`3492`.
|
|
punycode | | Implement
:rfc:`3492`.
|
|
| | Stateful codecs are not |
|
| | Stateful codecs are not |
|
| | supported. |
|
| | supported. |
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
...
@@ -1309,8 +1309,8 @@ encodings.
...
@@ -1309,8 +1309,8 @@ encodings.
|
| | literal in ASCII-encoded |
|
| | literal in ASCII-encoded |
|
| | Python source code, |
|
| | Python source code, |
|
| | except that quotes are |
|
| | except that quotes are |
|
| | not escaped. Decode
s from
|
|
| | not escaped. Decode
|
|
| |
Latin-1 source code.
|
|
| |
from Latin-1 source code.
|
|
| | Beware that Python source |
|
| | Beware that Python source |
|
| | code actually uses UTF-8 |
|
| | code actually uses UTF-8 |
|
| | by default. |
|
| | by default. |
...
@@ -1333,12 +1333,12 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
...
@@ -1333,12 +1333,12 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
..
tabularcolumns:: |l|L|L|L|
..
tabularcolumns:: |l|L|L|L|
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
|
Codec | Aliases |
Purpose
| Encoder / decoder |
|
Codec | Aliases |
Meaning
| Encoder / decoder |
+======================+==================+==============================+==============================+
+======================+==================+==============================+==============================+
|
base64_codec [#b64]_ | base64, base_64 | Convert
operand to multiline
| :meth:`base64.encodebytes` / |
|
base64_codec [#b64]_ | base64, base_64 | Convert
the operand to
| :meth:`base64.encodebytes` / |
|
| |
MIME base64 (the result
| :meth:`base64.decodebytes` |
|
| |
multiline MIME base64 (the
| :meth:`base64.decodebytes` |
|
| |
always includes a trailing
| |
|
| |
result always includes a
| |
|
| |
``'\n'``)
| |
|
| |
trailing ``'\n'``).
| |
|
| | | |
|
| | | |
|
| | .. versionchanged:: 3.4 | |
|
| | .. versionchanged:: 3.4 | |
|
| | accepts any | |
|
| | accepts any | |
...
@@ -1346,23 +1346,23 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
...
@@ -1346,23 +1346,23 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
|
| | as input for encoding and | |
|
| | as input for encoding and | |
|
| | decoding | |
|
| | decoding | |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
|
bz2_codec | bz2 | Compress the operand
| :meth:`bz2.compress` / |
|
bz2_codec | bz2 | Compress the operand
using
| :meth:`bz2.compress` / |
|
| |
using bz2
| :meth:`bz2.decompress` |
|
| |
bz2.
| :meth:`bz2.decompress` |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
|
hex_codec | hex | Convert
operand to
| :meth:`binascii.b2a_hex` / |
|
hex_codec | hex | Convert
the operand to
| :meth:`binascii.b2a_hex` / |
|
| | hexadecimal | :meth:`binascii.a2b_hex` |
|
| | hexadecimal | :meth:`binascii.a2b_hex` |
|
| | representation, with two | |
|
| | representation, with two | |
|
| | digits per byte
| |
|
| | digits per byte
.
| |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
|
quopri_codec | quopri, | Convert
operand to MIME
| :meth:`quopri.encode` with |
|
quopri_codec | quopri, | Convert
the operand to MIME
| :meth:`quopri.encode` with |
|
| quotedprintable, | quoted printable
| ``quotetabs=True`` / |
|
| quotedprintable, | quoted printable
.
| ``quotetabs=True`` / |
|
| quoted_printable | | :meth:`quopri.decode` |
|
| quoted_printable | | :meth:`quopri.decode` |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
|
uu_codec | uu | Convert the operand using | :meth:`uu.encode` / |
|
uu_codec | uu | Convert the operand using | :meth:`uu.encode` / |
|
| | uuencode
| :meth:`uu.decode` |
|
| | uuencode
.
| :meth:`uu.decode` |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
|
zlib_codec | zip, zlib | Compress the operand
| :meth:`zlib.compress` / |
|
zlib_codec | zip, zlib | Compress the operand
using
| :meth:`zlib.compress` / |
|
| |
using gzip
| :meth:`zlib.decompress` |
|
| |
gzip.
| :meth:`zlib.decompress` |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
.. [#b64] In addition to :term:`bytes-like objects <bytes-like object>`,
.. [#b64] In addition to :term:`bytes-like objects <bytes-like object>`,
...
@@ -1388,10 +1388,11 @@ mapping. It is not supported by :meth:`str.encode` (which only produces
...
@@ -1388,10 +1388,11 @@ mapping. It is not supported by :meth:`str.encode` (which only produces
.. tabularcolumns:: |l|l|L|
.. tabularcolumns:: |l|l|L|
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
|
Codec | Aliases |
Purpose
|
|
Codec | Aliases |
Meaning
|
+====================+=========+===========================+
+====================+=========+===========================+
|
rot_13 | rot13 | Returns the Caesar-cypher |
|
rot_13 | rot13 | Return the Caesar-cypher |
|
| | encryption of the operand |
|
| | encryption of the |
|
| | operand. |
+--------------------+---------+---------------------------+
+--------------------+---------+---------------------------+
.. versionadded:: 3.2
.. versionadded:: 3.2
...
@@ -1438,7 +1439,7 @@ names (:mod:`http.client` then also transparently sends an IDNA hostname in the
...
@@ -1438,7 +1439,7 @@ names (:mod:`http.client` then also transparently sends an IDNA hostname in the
:mailheader:`Host`
field if it sends that field at all).
:mailheader:`Host`
field if it sends that field at all).
When receiving host names from the wire (such as in reverse name lookup), no
When receiving host names from the wire (such as in reverse name lookup), no
automatic conversion to Unicode is performed:
A
pplications wishing to present
automatic conversion to Unicode is performed:
a
pplications wishing to present
such host names to the user should decode them to Unicode.
such host names to the user should decode them to Unicode.
The module :mod:`encodings.idna` also implements the nameprep procedure, which
The module :mod:`encodings.idna` also implements the nameprep procedure, which
...
@@ -1470,7 +1471,7 @@ functions can be used directly if desired.
...
@@ -1470,7 +1471,7 @@ functions can be used directly if desired.
.. module:: encodings.mbcs
.. module:: encodings.mbcs
:synopsis: Windows ANSI codepage
:synopsis: Windows ANSI codepage
Encode operand according to
the ANSI codepage (CP_ACP).
This module implements
the ANSI codepage (CP_ACP).
.. availability:: Windows only.
.. availability:: Windows only.
...
@@ -1489,7 +1490,7 @@ Encode operand according to the ANSI codepage (CP_ACP).
...
@@ -1489,7 +1490,7 @@ Encode operand according to the ANSI codepage (CP_ACP).
:synopsis: UTF-8 codec with BOM signature
:synopsis: UTF-8 codec with BOM signature
..
moduleauthor:: Walter Dörwald
..
moduleauthor:: Walter Dörwald
This module implements a variant of the UTF-8 codec
: On encoding
a UTF-8 encoded
This module implements a variant of the UTF-8 codec
. On encoding,
a UTF-8 encoded
BOM will be prepended to the UTF-8 encoded bytes. For the stateful encoder this
BOM will be prepended to the UTF-8 encoded bytes. For the stateful encoder this
is only done once (on the first write to the byte stream).
For decoding
an
is only done once (on the first write to the byte stream).
On decoding,
an
optional UTF-8 encoded BOM at the start of the data will be skipped.
optional UTF-8 encoded BOM at the start of the data will be skipped.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment