encodings.
-.. _surrogateescape:
.. _codec-base-classes:
Codec Base Classes
codec will handle encoding and decoding errors.
+.. _surrogateescape:
.. _error-handlers:
Error Handlers
| | :func:`backslashreplace_errors`. |
+-------------------------+-----------------------------------------------+
| ``'namereplace'`` | Replace with ``\N{...}`` escape sequences |
-| | (only for encoding). |
+| | (only for encoding). Implemented in |
+| | :func:`namereplace_errors`. |
+-------------------------+-----------------------------------------------+
| ``'surrogateescape'`` | On decoding, replace byte with individual |
| | surrogate code ranging from ``U+DC80`` to |
.. function:: namereplace_errors(exception)
- Implements the ``namereplace`` error handling (for encoding only): the
+ Implements the ``'namereplace'`` error handling (for encoding with
+ :term:`text encodings <text encoding>` only): the
unencodable character is replaced by a ``\N{...}`` escape sequence.
.. versionadded:: 3.5