codecs.encode()

codecs.encode(obj, encoding='utf-8', errors='strict') Encodes obj using the codec registered for encoding. Errors may be given to set the desired error handling scheme. The default error handler is 'strict' meaning that encoding errors raise ValueError (or a more codec specific subclass, such as UnicodeEncodeError). Refer to Codec Base Classes for more information on codec error handling.

codecs.decode()

codecs.decode(obj, encoding='utf-8', errors='strict') Decodes obj using the codec registered for encoding. Errors may be given to set the desired error handling scheme. The default error handler is 'strict' meaning that decoding errors raise ValueError (or a more codec specific subclass, such as UnicodeDecodeError). Refer to Codec Base Classes for more information on codec error handling.

codecs.EncodedFile()

codecs.EncodedFile(file, data_encoding, file_encoding=None, errors='strict') Return a StreamRecoder instance, a wrapped version of file which provides transparent transcoding. The original file is closed when the wrapped version is closed. Data written to the wrapped file is decoded according to the given data_encoding and then written to the original file as bytes using file_encoding. Bytes read from the original file are decoded according to file_encoding, and the result is encoded using d

codecs.CodecInfo.encode

encode decode The stateless encoding and decoding functions. These must be functions or methods which have the same interface as the encode() and decode() methods of Codec instances (see Codec Interface). The functions or methods are expected to work in a stateless mode.

codecs.CodecInfo.incrementalencoder

incrementalencoder incrementaldecoder Incremental encoder and decoder classes or factory functions. These have to provide the interface defined by the base classes IncrementalEncoder and IncrementalDecoder, respectively. Incremental codecs can maintain state.

codecs.CodecInfo.incrementaldecoder

incrementaldecoder Incremental encoder and decoder classes or factory functions. These have to provide the interface defined by the base classes IncrementalEncoder and IncrementalDecoder, respectively. Incremental codecs can maintain state.

codecs.CodecInfo.streamreader

streamreader Stream writer and reader classes or factory functions. These have to provide the interface defined by the base classes StreamWriter and StreamReader, respectively. Stream codecs can maintain state.

codecs.CodecInfo.name

name The name of the encoding.

codecs.Codec.encode()

Codec.encode(input[, errors]) Encodes the object input and returns a tuple (output object, length consumed). For instance, text encoding converts a string object to a bytes object using a particular character set encoding (e.g., cp1252 or iso-8859-1). The errors argument defines the error handling to apply. It defaults to 'strict' handling. The method may not store state in the Codec instance. Use StreamWriter for codecs which have to keep state in order to make encoding efficient. The encod

codecs.backslashreplace_errors()

codecs.backslashreplace_errors(exception) Implements the 'backslashreplace' error handling (for text encodings only): malformed data is replaced by a backslashed escape sequence.