codecs
The codecs module provides an interface for accessing different string encoding and decoding functions (codecs) as well as a collection of base classes that can be used to define new codecs. The following functions are available:
register(search_function)
Registers a new codec search function. This function should take a single argument in the form of an encoding string (for example, 'utf-8') and return a tuple of functions (encoder, decoder, streamreader, streamwriter).
lookup(encoding)
Looks up a codec in the codec registry. encoding is a string such as 'utf-8'. Returns a tuple of functions (encoder, decoder, streamreader, streamwriter). Internally, this function keeps a cache of previously used encodings. If a match is not found in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access