summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-11-23 01:13:36 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-11-23 01:13:36 (GMT)
commit9c1aed8f94a2b7a40c3a4db60cb289c90e001896 (patch)
tree563a50fe1083bc0fdba7ea27e0def43f93c91455 /Doc/library
parent12820c0d5d6b3ccbd191703d1003794ddb1bcac9 (diff)
downloadcpython-9c1aed8f94a2b7a40c3a4db60cb289c90e001896.zip
cpython-9c1aed8f94a2b7a40c3a4db60cb289c90e001896.tar.gz
cpython-9c1aed8f94a2b7a40c3a4db60cb289c90e001896.tar.bz2
Close #7475: Restore binary & text transform codecs
The codecs themselves were restored in Python 3.2, this completes the restoration by adding back the convenience aliases. These aliases were originally left out due to confusing errors when attempting to use them with the text encoding specific convenience methods. Python 3.4 includes several improvements to those errors, thus permitting the aliases to be restored as well.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/codecs.rst116
1 files changed, 70 insertions, 46 deletions
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
index 358fde7..ef79918 100644
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -1188,6 +1188,9 @@ common use case for codecs, the underlying codec infrastructure supports
arbitrary data transforms rather than just text encodings). For asymmetric
codecs, the stated purpose describes the encoding direction.
+Text Encodings
+^^^^^^^^^^^^^^
+
The following codecs provide :class:`str` to :class:`bytes` encoding and
:term:`bytes-like object` to :class:`str` decoding, similar to the Unicode text
encodings.
@@ -1234,62 +1237,83 @@ encodings.
| | | .. deprecated:: 3.3 |
+--------------------+---------+---------------------------+
-The following codecs provide :term:`bytes-like object` to :class:`bytes`
-mappings.
-
-
-.. tabularcolumns:: |l|L|L|
-
-+----------------------+------------------------------+------------------------------+
-| Codec | Purpose | Encoder / decoder |
-+======================+==============================+==============================+
-| base64_codec [#b64]_ | Convert operand to MIME | :meth:`base64.b64encode` / |
-| | base64 (the result always | :meth:`base64.b64decode` |
-| | includes a trailing | |
-| | ``'\n'``) | |
-| | | |
-| | .. versionchanged:: 3.4 | |
-| | accepts any | |
-| | :term:`bytes-like object` | |
-| | as input for encoding and | |
-| | decoding | |
-+----------------------+------------------------------+------------------------------+
-| bz2_codec | Compress the operand | :meth:`bz2.compress` / |
-| | using bz2 | :meth:`bz2.decompress` |
-+----------------------+------------------------------+------------------------------+
-| hex_codec | Convert operand to | :meth:`base64.b16encode` / |
-| | hexadecimal | :meth:`base64.b16decode` |
-| | representation, with two | |
-| | digits per byte | |
-+----------------------+------------------------------+------------------------------+
-| quopri_codec | Convert operand to MIME | :meth:`quopri.encodestring` /|
-| | quoted printable | :meth:`quopri.decodestring` |
-+----------------------+------------------------------+------------------------------+
-| uu_codec | Convert the operand using | :meth:`uu.encode` / |
-| | uuencode | :meth:`uu.decode` |
-+----------------------+------------------------------+------------------------------+
-| zlib_codec | Compress the operand | :meth:`zlib.compress` / |
-| | using gzip | :meth:`zlib.decompress` |
-+----------------------+------------------------------+------------------------------+
+.. _binary-transforms:
+
+Binary Transforms
+^^^^^^^^^^^^^^^^^
+
+The following codecs provide binary transforms: :term:`bytes-like object`
+to :class:`bytes` mappings.
+
+
+.. tabularcolumns:: |l|L|L|L|
+
++----------------------+------------------+------------------------------+------------------------------+
+| Codec | Aliases | Purpose | Encoder / decoder |
++======================+==================+==============================+==============================+
+| base64_codec [#b64]_ | base64, base_64 | Convert operand to MIME | :meth:`base64.b64encode` / |
+| | | base64 (the result always | :meth:`base64.b64decode` |
+| | | includes a trailing | |
+| | | ``'\n'``) | |
+| | | | |
+| | | .. versionchanged:: 3.4 | |
+| | | accepts any | |
+| | | :term:`bytes-like object` | |
+| | | as input for encoding and | |
+| | | decoding | |
++----------------------+------------------+------------------------------+------------------------------+
+| bz2_codec | bz2 | Compress the operand | :meth:`bz2.compress` / |
+| | | using bz2 | :meth:`bz2.decompress` |
++----------------------+------------------+------------------------------+------------------------------+
+| hex_codec | hex | Convert operand to | :meth:`base64.b16encode` / |
+| | | hexadecimal | :meth:`base64.b16decode` |
+| | | representation, with two | |
+| | | digits per byte | |
++----------------------+------------------+------------------------------+------------------------------+
+| quopri_codec | quopri, | Convert operand to MIME | :meth:`quopri.encodestring` /|
+| | quotedprintable, | quoted printable | :meth:`quopri.decodestring` |
+| | quoted_printable | | |
++----------------------+------------------+------------------------------+------------------------------+
+| uu_codec | uu | Convert the operand using | :meth:`uu.encode` / |
+| | | uuencode | :meth:`uu.decode` |
++----------------------+------------------+------------------------------+------------------------------+
+| zlib_codec | zip, zlib | Compress the operand | :meth:`zlib.compress` / |
+| | | using gzip | :meth:`zlib.decompress` |
++----------------------+------------------+------------------------------+------------------------------+
.. [#b64] In addition to :term:`bytes-like objects <bytes-like object>`,
``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for
decoding
+.. versionadded:: 3.2
+ Restoration of the binary transforms.
-The following codecs provide :class:`str` to :class:`str` mappings.
+.. versionchanged:: 3.4
+ Restoration of the aliases for the binary transforms.
-.. tabularcolumns:: |l|L|
-+--------------------+---------------------------+
-| Codec | Purpose |
-+====================+===========================+
-| rot_13 | Returns the Caesar-cypher |
-| | encryption of the operand |
-+--------------------+---------------------------+
+.. _text-transforms:
+
+Text Transforms
+^^^^^^^^^^^^^^^
+
+The following codec provides a text transform: a :class:`str` to :class:`str`
+mapping.
+
+.. tabularcolumns:: |l|l|L|
+
++--------------------+---------+---------------------------+
+| Codec | Aliases | Purpose |
++====================+=========+===========================+
+| rot_13 | rot13 | Returns the Caesar-cypher |
+| | | encryption of the operand |
++--------------------+---------+---------------------------+
.. versionadded:: 3.2
- bytes-to-bytes and str-to-str codecs.
+ Restoration of the ``rot_13`` text transform.
+
+.. versionchanged:: 3.4
+ Restoration of the ``rot13`` alias.
:mod:`encodings.idna` --- Internationalized Domain Names in Applications