python-chardet
Port variant v15
Summary Universal character encoding detector (3.15)
Package version 7.7.0
Homepage https://github.com/chardet/chardet
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v14
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 13 NOV 2026, 13:25:52 UTC
Port created 30 MAY 2017, 20:17:50 UTC
Subpackage Descriptions
single # chardet Universal character encoding detector. [![License: 0BSD]](LICENSE) [Documentation] [codecov] 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. Python 3.10+, zero runtime dependencies, works on PyPy. [Read more details about the rewrite process.] ## Why chardet 7? **99.7% accuracy** on 3,138 test files. **359x faster** than chardet 6.0.0, and **+13.1pp more accurate** than charset-normalizer 3.5.2 while being 1.3x faster. **Language detection** for every text result. **MIME type detection** for binary files. **0BSD licensed.** Large inputs don't need a byte cap: `detect(data, max_bytes=len(data))` on a 272 MiB file finishes in about 0.2 to 0.5 s, and the UTF-8 verdict is validated over every byte examined, never sampled. See [the performance docs] for the full large-input tables. | | chardet 7.7.0 (compiled) | chardet 6.0.0 | [charset-normalizer] 3.5.2 | | ---------------------- | :--------------------: | :-----------: | :-------------------------: | | Accuracy (3,138 files) | **99.7%** | 84.4% | 86.6% | | Speed | **3,125 files/s** (771 pure) | 9 files/s | 2,438 files/s | | Language detection | **93.0%** | 38.7% | 54.8% | | Peak memory | **28.2 MiB** | n/a | 71.0 MiB | | Streaming detection | **yes** | yes | no | | Encoding era filtering | **yes** | no | no | | Encoding filters | **yes** | no | yes | | MIME type detection | **yes** | no | no | | Supported encodings | 99 | 84 | 99 | | License | 0BSD | LGPL | MIT | [charset-normalizer]: https://github.com/jawah/charset_normalizer ## Installation `bash pip install chardet ` ## Quick Start ```python import chardet chardet.detect(b"Python is a great programming language for beginners and experts alike.") # {'encoding': 'ascii', 'confidence': 1.0, 'language': 'en', 'mime_type': 'text/plain'} # UTF-8 English with accented characters chardet.detect("The naïve approach doesn't always work in complex systems.".encode("utf-8")) # {'encoding': 'utf-8', 'confidence': 0.84, 'language': 'en', 'mime_type': 'text/plain'} # Japanese EUC-JP chardet.detect("日本語の文字コード検出テストです。このテキストはEUC-JPでエンコードされています。正しく検出できるか確認します。".encode("euc-jp")) # {'encoding': 'EUC-JP', 'confidence': 1.0, 'language': 'ja', 'mime_type': 'text/plain'} # Get all candidate encodings ranked by confidence text = "Le café est une boisson très populaire en France et dans le monde entier." results = chardet.detect_all(text.encode("windows-1252")) for r in results[:4]: print(r["encoding"], round(r["confidence"], 2)) # Windows-1252 0.31 # iso8859-15 0.31 # ISO-8859-1 0.31 # MacRoman 0.3 ``` ### Streaming Detection For large files or network streams, use `UniversalDetector` to feed data
Configuration Switches (platform-specific settings discarded)
PY314 OFF Build using Python 3.14 PY315 ON Build using Python 3.15
Package Dependencies by Type
Build (only) python315:dev:std
python-pip:single:v15
autoselect-python:single:std
Build and Runtime python315:primary:std
Download groups
main mirror://PYPIWHL/cc/75/88a3eb36264375ff951bd2f9397c409727ab6aa6a18e1bd933851571d421
Distribution File Information
11cf9b719ea3675a2a7d8a3071bbe4d7ea24b26bfe39a51588d515ddd05cacad 706680 python-src/chardet-7.7.0-py3-none-any.whl
Ports that require python-chardet:v15
python-cyclonedx-bom:v15 Software Bill of Materials generator (3.15)
python-encutils:v15 Text file encoding detection functions (3.15)