Help on package encodings:
encodings — Standard "encodings" Package
| Use Case | Command | Description |
|---|---|---|
| Normalize an encoding name | encodings.normalize_encoding('utf-8') |
Collapses non-alphanumeric characters to underscores according to normalization rules |
| Search for a codec by name | encodings.search_function('utf-8') |
Returns the CodecInfo object for the given encoding |
| List all available encoding aliases | encodings.aliases.getaliases() |
Returns a sequence of alias names (normalized) |
| Get codec info via standard library | codecs.lookup('utf-8') |
Returns a CodecInfo object (uses the encodings package) |
https://docs.python.org/3.10/library/encodings.html
The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.
Standard Python encoding modules are stored in this package directory.
Codec modules must have names corresponding to normalized encoding names as defined in the normalize_encoding() function below, e.g. 'utf-8' must be implemented by the module utf_8.py.
Each codec module must export the following interface:
getregentry() → codecs.CodecInfo objectgetregentry() API must return a CodecInfo object with encoder, decoder, incrementalencoder, incrementaldecoder, streamwriter and streamreader attributes which adhere to the Python Codec Interface Standard.In addition, a module may optionally also define the following APIs which are then used by the package's codec search function:
getaliases() → sequence of encoding name strings to use as aliasesgetaliases() must be normalized encoding names as defined by normalize_encoding().Written by Marc-Andre Lemburg (mal AT lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
Builtins: builtins.LookupError, builtins.SystemError
Method resolution order:
CodecRegistryErrorbuiltins.LookupErrorbuiltins.SystemErrorbuiltins.Exceptionbuiltins.BaseExceptionbuiltins.objectData descriptors defined here:
__weakref__ — list of weak references to the object (if defined)Methods inherited from builtins.LookupError:
__init__(self, /, *args, **kwargs) — Initialize self. See help(type(self)) for accurate signature.Static methods inherited from builtins.LookupError:
__new__(*args, **kwargs) from builtins.type — Create and return a new object.Methods inherited from builtins.BaseException:
__delattr__(self, name, /) — Implement delattr(self, name).__getattribute__(self, name, /) — Return getattr(self, name).__reduce__(...) — Helper for pickle.__repr__(self, /) — Return repr(self).__setattr__(self, name, value, /) — Implement setattr(self, name, value).__setstate__(...)__str__(self, /) — Return str(self).with_traceback(...) — Exception.with_traceback(tb) — set self.__traceback__ to tb and return self.Data descriptors inherited from builtins.BaseException:
__cause__ — exception cause__context__ — exception context__dict____suppress_context____traceback__argsNormalize an encoding name.
Normalization works as follows: all non-alphanumeric characters except the dot used for Python package names are collapsed and replaced with a single underscore, e.g. ' -;#' becomes '_'. Leading and trailing underscores are removed.
Note that encoding names should be ASCII only.
Search for a codec by name. Returns the CodecInfo object if found, otherwise raises LookupError.
/usr/lib/python3.10/encodings/__init__.py
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 17:05 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)