On this page
codecs.register
Prev: codecs.open | Up: codecs | Next: codecs.register_error
Rel: codecs.backslashreplace_errors, codecs.Codec, codecs.CodecInfo, codecs.decode
Ref: docs.python.org — codecs.register
Tags: #public #python3 #stdlib #codecs
Import
import codecs
from codecs import register
Signature & Overview
codecs.register(search_function, /)
Register a codec search function.
Usage
import codecs
# Registers a custom codec search function: def search(name: str) -> CodecInfo | None
assert callable(codecs.register)
Gotchas
- Search functions are cached: Call
codecs.unregister(fn)(Python 3.10+) to remove a registered search function.
REPL Inspect
from codecs import register
help(register)
Linked from
Related notes
- tuts/python3/stdlib_module/codecs/open Linked here; links to this page; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/register_error Linked here; links to this page; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/codecs/backslashreplace_errors Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/Codec Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/CodecInfo Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/decode Linked here; shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/encode shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/EncodedFile shared tags: #codecs, #stdlib
- tuts/python3/stdlib_module/codecs/getdecoder shared tags: #codecs, #stdlib