Skip to content

Commit fd1b26e

Browse files
Petr's suggestions
1 parent 6479dce commit fd1b26e

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

Doc/library/functions.rst

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ are always available. They are listed here in alphabetical order.
14231423
*errors* is an optional string that specifies how encoding and decoding
14241424
errors are to be handled—this cannot be used in binary mode.
14251425
A variety of standard error handlers are available
1426-
(listed under :ref:`error-handlers`, and reproduced below for convenience),
1426+
(listed under :ref:`error-handlers`, and summarized below for convenience),
14271427
though any error handling name that has been registered with
14281428
:func:`codecs.register_error` is also valid. The standard names
14291429
include:
@@ -1441,13 +1441,13 @@ are always available. They are listed here in alphabetical order.
14411441
Note that ignoring encoding errors can lead to data loss.
14421442
* - ``'replace'``
14431443
- Replace malformed data with a replacement marker.
1444-
On encoding, use ``?`` (ASCII character).
1445-
On decoding, use ```` (U+FFFD, the official REPLACEMENT CHARACTER)
1444+
On writing, use ``?`` (ASCII character 63).
1445+
On reading, use ```` (U+FFFD, the official REPLACEMENT CHARACTER)
14461446
* - ``'backslashreplace'``
14471447
- Replace malformed data with backslashed escape sequences.
1448-
On encoding, use hexadecimal form of Unicode code point with formats
1448+
On writing, use hexadecimal form of Unicode code points with formats
14491449
:samp:`\\x{hh}` :samp:`\\u{xxxx}` :samp:`\\U{xxxxxxxx}`.
1450-
On decoding, use hexadecimal form of byte value with format :samp:`\\x{hh}`.
1450+
On reading, use hexadecimal form of byte value with format :samp:`\\x{hh}`.
14511451
* - ``'surrogateescape'``
14521452
- Will represent any incorrect bytes as low
14531453
surrogate code units ranging from ``U+DC80`` to ``U+DCFF``.
@@ -1457,20 +1457,11 @@ are always available. They are listed here in alphabetical order.
14571457
unknown encoding.
14581458
* - ``'surrogatepass'``
14591459
- Only available for Unicode codecs.
1460-
Allow encoding and decoding surrogate code point
1461-
(``U+D800`` - ``U+DFFF``) as normal code point. Otherwise these codecs
1462-
treat the presence of surrogate code point in :class:`str` as an error.
1463-
1464-
The following error handlers are only applicable to encoding (within
1465-
:term:`text encodings <text encoding>`):
1466-
1467-
.. list-table::
1468-
:header-rows: 1
1469-
1470-
* - Error handler
1471-
- Description
1460+
Allow encoding and decoding surrogate code points
1461+
(``U+D800`` - ``U+DFFF``) as normal code points. Otherwise these codecs
1462+
treat the presence of surrogate code points in :class:`str` as an error.
14721463
* - ``'xmlcharrefreplace'``
1473-
- Only supported when writing to a file.
1464+
- Only supported when writing.
14741465
Characters not supported by the encoding are replaced with the
14751466
appropriate XML character reference :samp:`&#{nnn};`.
14761467
* - ``'namereplace'``

0 commit comments

Comments
 (0)