Skip to content

gh-48181: Document codecs.charmap_build #135997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Doc/library/codecs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ any codec:
:exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more
information on codec error handling.

.. function:: charmap_build(string)

Return a mapping suitable for decoding a custom single-byte encoding.
Given a string *string* of up to 256 characters representing an encoding
table, returns a dictionary mapping character ordinals to byte values.
Raises a :exc:`TypeError` on invalid input.

The full details for each codec can also be looked up directly:

.. function:: lookup(encoding, /)
Expand Down
Loading