PyDocs

Binary Data Services

codecs

codecs -- Python Codec Registry, API and helpers.


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
Symbols in codecs

b

backslashreplace_errors
Implements the 'backslashreplace' error handling, which replaces malformed data with a backslashed escape sequence.
BOM
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_BE
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_LE
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF16
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF16_BE
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF16_LE
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF32
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF32_BE
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF32_LE
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.
BOM_UTF8
These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings.

c

charmap_build
Return a mapping suitable for encoding with a custom single-byte encoding.
Codec
Defines the interface for stateless encoders/decoders.
CodecInfo
Codec details when looking up the codec registry
codecs.escape_decode
Decode input from escape sequences back to the original bytes.
codecs.escape_encode
Encode input using escape sequences.

d

decode
Decodes obj using the codec registered for encoding.

e

encode
Encodes obj using the codec registered for encoding.
EncodedFile
Return a wrapped version of file which provides transparent encoding translation.

g

getdecoder
Lookup up the codec for the given encoding and return its decoder function.
getencoder
Lookup up the codec for the given encoding and return its encoder function.
getincrementaldecoder
Lookup up the codec for the given encoding and return its IncrementalDecoder class or factory function.
getincrementalencoder
Lookup up the codec for the given encoding and return its IncrementalEncoder class or factory function.
getreader
Lookup up the codec for the given encoding and return its StreamReader class or factory function.
getwriter
Lookup up the codec for the given encoding and return its StreamWriter class or factory function.

i

ignore_errors
Implements the 'ignore' error handling, which ignores malformed data and continues.
IncrementalDecoder
An IncrementalDecoder decodes an input in multiple steps.
IncrementalEncoder
An IncrementalEncoder encodes an input in multiple steps.
iterdecode
Decoding iterator.
iterencode
Encoding iterator.

l

lookup
Looks up a codec tuple in the Python codec registry and returns a CodecInfo object.
lookup_error
Return the error handler for the specified error handling name or raise a LookupError, if no handler exists under this name.

n

namereplace_errors
Implements the 'namereplace' error handling, which replaces an unencodable character with a \N{...} escape sequence.

o

open
Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding.

r

readbuffer_encode
Return a tuple containing the raw bytes of buffer, a buffer-compatible object or str (encoded to UTF-8 before processing), and their length in bytes.
register
Register a codec search function.
register_error
Register the specified error handler under the name errors.
replace_errors
Implements the 'replace' error handling, which replaces malformed data with a replacement marker.

s

StreamReader
Constructor for a StreamReader instance.
StreamReaderWriter
StreamReaderWriter instances allow wrapping streams which work in both read and write modes.
StreamRecoder
StreamRecoder instances translate data from one encoding to another.
StreamWriter
Constructor for a StreamWriter instance.
strict_errors
Implements the 'strict' error handling, which raises a UnicodeError on coding errors.

u

unregister
Unregister a codec search function and clear the registry's cache.

x

xmlcharrefreplace_errors
Implements the 'xmlcharrefreplace' error handling, which replaces an unencodable character with the appropriate XML character reference.