API Reference

chardet

chardet 7 is a ground-up, 0BSD-licensed rewrite of chardet. Same package name, same public API — drop-in replacement for chardet 5.x/6.x, just much faster…

Official Documentation ↗
CompatibilityThis documentation covers version v5.2.0. Check the official docs for the latest API surface.

Installation

pippip install chardet

Methods

Overview

chardet 7 is a ground-up, 0BSD-licensed rewrite of chardet. Same package name, same public API — drop-in replacement for chardet 5.x/6.x, just much faster and more accurate.

API reference status

This page lists only entry points that appear verbatim in the official README examples: chardet.detect, chardet.detect_all, encode, round. Parameter and return types are not given by the official README, so signatures are marked unverified.

Verification notes

Errors

The official API reference declares the following error types:

API reference evidence

Fetched from official sources on 2026-11-08T17:41:29+08:00 via PowerShell Invoke-WebRequest 下载官方仓库 5.2.0 tag 的 chardet/init.py(raw.githubusercontent.com/chardet/chardet/5.2.0),Grep 提取函数定义与 raise 语句;WebFetch https://chardet.readthedocs.io/en/latest/usage.html 交叉核对 detect/detect_all 用法.

FAQ

What does chardet do?
chardet 7 is a ground-up, 0BSD-licensed rewrite of chardet.
How do I install chardet?
Run `pip install chardet`.
Where can I verify the API details?
Official repository/documentation: https://github.com/chardet/chardet. Checked on 2026-11-04; signatures and return values not stated in the official README are marked unverified.