Class
codecs.Codec

Defines the interface for stateless encoders/decoders.

strict - raise a ValueError error (or a subclass) ignore - ignore the character and continue with the next replace - replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT CHARACTER for the builtin Unicode codecs on decoding and ? on encoding. xmlcharrefreplace - Replace with the appropriate XML character reference (only for encoding). backslashreplace - Replace with backslashed escape sequences (only for encoding).

The .encode()/.decode() methods may use different error handling schemes by providing the errors argument. These string values are predefined:

The set of allowed values can be extended via register_error.

Base classes

There are no base classes.

Implemented Interfaces

There are no implemented interfaces.

Attributes/Properties

There are no attributes in this class.

Methods

Known Subclasses