cchardet
cChardet is high speed universal character encoding detector.
What it is and what it does
cchardet is a high-speed character encoding detector that identifies the encoding of raw byte strings by analyzing statistical patterns. It wraps the C library uchardet and supports a wide range of international encodings including UTF-8, UTF-16, CJK variants (Big5, EUC-JP, Shift-JIS, GB18030, etc.), Cyrillic, Arabic, and many European single-byte encodings. The package provides a simple API: call detect() on a byte buffer to get back a dictionary with the detected encoding and language hint.
The main use case is preprocessing text data when the source encoding is unknown—common in web scraping, log parsing, and data import workflows. It has no runtime dependencies and installs via prebuilt wheels on most platforms. However, the project is aging: the last release was 2020-10-27, and while the repository remains active, there have been no new package versions for over four years. The copyleft license (Mozilla Public License) requires careful review if you plan to distribute derived works.
Use it for:
- Detect encoding of downloaded web pages or API responses before parsing.
- Identify encoding of legacy log files or CSV imports with unknown character sets.
- Preprocess user-uploaded text files to normalize encoding before storage.
- Batch-process mixed-encoding document collections to extract text reliably.
- Auto-detect encoding in text processing pipelines to avoid manual charset specification.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
cchardet detects the character encoding of byte strings using a C binding to uchardet, supporting dozens of international encodings and languages with high speed.
Yes, if you need fast encoding detection and can accept the aging codebase. The package is stable with no known vulnerabilities, but the lack of updates since 2020-10-27 means it may not support newer Python versions or benefit from recent uchardet improvements. Use it for production workloads where encoding detection is a bottleneck and you are comfortable pinning to version 2.1.7; monitor the repository for future releases or evaluate alternatives if you require active maintenance.
Install
cchardet on PyPI
pip
pip install cchardetuv
uv add cchardetpoetry
poetry add cchardetInstalling cchardet
Before you install
Medium install friction due to compiled C extensions; prebuilt wheels are available for Python 3.6–3.9 on Windows, Linux, and macOS x86_64/i686, but the package is aging—last release was 2020-10-27 and no updates in over four years despite an active repository.
License in practice
Licensed under Mozilla Public License (copyleft), with dual licensing also under GPL and LGPL per classifiers. Copyleft terms require derivative works to be distributed under compatible terms; review your project's license compatibility before use.
Quickstart
import cchardet
with open('file.txt', 'rb') as f:
result = cchardet.detect(f.read())
print(result)
Requires a C compiler and build tools at install time; prebuilt wheels are available for common platforms but not all architectures.
Verify before relying
- Whether the package remains compatible with Python 3.10+ despite no official release since 2020.
- Current performance relative to modern encoding detectors in production workloads.
- Whether the underlying uchardet library has received security or accuracy updates since the last cchardet release.
- Confidence score range and interpretation for detect() results.
Package facts
| License | Mozilla Public License (copyleft) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | aging — 2,117 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,435,620/month — #1,623 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cchardet-2.1.7-cp36-cp36m-macosx_10_9_x86_64.whl; cchardet-2.1.7-cp36-cp36m-manylinux1_i686.whl; cchardet-2.1.7-cp36-cp36m-manylinux1_x86_64.whl; cchardet-2.1.7-cp36-cp36m-manylinux2010_i686.whl; cchardet-2.1.7-cp36-cp36m-manylinux2010_x86_64.whl; cchardet-2.1.7-cp36-cp36m-win32.whl; cchardet-2.1.7-cp36-cp36m-win_amd64.whl; cchardet-2.1.7-cp37-cp37m-macosx_10_9_x86_64.whl; cchardet-2.1.7-cp37-cp37m-manylinux1_i686.whl; cchardet-2.1.7-cp37-cp37m-manylinux1_x86_64.whl; cchardet-2.1.7-cp37-cp37m-manylinux2010_i686.whl; cchardet-2.1.7-cp37-cp37m-manylinux2010_x86_64.whl; cchardet-2.1.7-cp37-cp37m-win32.whl; cchardet-2.1.7-cp37-cp37m-win_amd64.whl; cchardet-2.1.7-cp38-cp38-macosx_10_9_x86_64.whl; cchardet-2.1.7-cp38-cp38-manylinux1_i686.whl; cchardet-2.1.7-cp38-cp38-manylinux1_x86_64.whl; cchardet-2.1.7-cp38-cp38-manylinux2010_i686.whl; cchardet-2.1.7-cp38-cp38-manylinux2010_x86_64.whl; cchardet-2.1.7-cp38-cp38-win32.whl
Keywords: cython, chardet, charsetdetect
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
chardetDetects character encoding and language in byte…
permissive · top 1,000 on PyPI
faust-cchardetDetects character encoding in binary data with…
copyleft · top 15,000 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
encutilsProvides encoding and character detection…
copyleft · top 5,000 on PyPI
webencodingsImplements the WHATWG Encoding standard to map…
permissive · top 1,000 on PyPI
isbinaryDetermines whether a file is binary or text by…
permissive · top 15,000 on PyPI
gibberish-detectorDetects whether strings are gibberish or valid…
permissive · top 15,000 on PyPI
cwcwidthcwcwidth provides fast Python bindings for…
permissive · top 15,000 on PyPI
mbstrdecoderDecodes multi-byte character strings by…
permissive · top 5,000 on PyPI
UnidecodeConverts Unicode text to ASCII-safe…
copyleft · top 1,000 on PyPI