| 1 |
Metadata-Version: 2.4 |
| 2 |
Name: charset-normalizer |
| 3 |
Version: 3.4.2 |
| 4 |
Summary: The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. |
| 5 |
Author-email: "Ahmed R. TAHRI" <[email protected]> |
| 6 |
Maintainer-email: "Ahmed R. TAHRI" <[email protected]> |
| 7 |
License: MIT |
| 8 |
Project-URL: Changelog, https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md |
| 9 |
Project-URL: Documentation, https://charset-normalizer.readthedocs.io/ |
| 10 |
Project-URL: Code, https://github.com/jawah/charset_normalizer |
| 11 |
Project-URL: Issue tracker, https://github.com/jawah/charset_normalizer/issues |
| 12 |
Keywords: encoding,charset,charset-detector,detector,normalization,unicode,chardet,detect |
| 13 |
Classifier: Development Status :: 5 - Production/Stable |
| 14 |
Classifier: Intended Audience :: Developers |
| 15 |
Classifier: License :: OSI Approved :: MIT License |
| 16 |
Classifier: Operating System :: OS Independent |
| 17 |
Classifier: Programming Language :: Python |
| 18 |
Classifier: Programming Language :: Python :: 3 |
| 19 |
Classifier: Programming Language :: Python :: 3.7 |
| 20 |
Classifier: Programming Language :: Python :: 3.8 |
| 21 |
Classifier: Programming Language :: Python :: 3.9 |
| 22 |
Classifier: Programming Language :: Python :: 3.10 |
| 23 |
Classifier: Programming Language :: Python :: 3.11 |
| 24 |
Classifier: Programming Language :: Python :: 3.12 |
| 25 |
Classifier: Programming Language :: Python :: 3.13 |
| 26 |
Classifier: Programming Language :: Python :: 3 :: Only |
| 27 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 28 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 29 |
Classifier: Topic :: Text Processing :: Linguistic |
| 30 |
Classifier: Topic :: Utilities |
| 31 |
Classifier: Typing :: Typed |
| 32 |
Requires-Python: >=3.7 |
| 33 |
Description-Content-Type: text/markdown |
| 34 |
License-File: LICENSE |
| 35 |
Provides-Extra: unicode-backport |
| 36 |
Dynamic: license-file |
| 37 |
|
| 38 |
<h1 align="center">Charset Detection, for Everyone 👋</h1> |
| 39 |
|
| 40 |
<p align="center"> |
| 41 |
<sup>The Real First Universal Charset Detector</sup><br> |
| 42 |
<a href="https://pypi.org/project/charset-normalizer"> |
| 43 |
<img src="https://img.shields.io/pypi/pyversions/charset_normalizer.svg?orange=blue" /> |
| 44 |
</a> |
| 45 |
<a href="https://pepy.tech/project/charset-normalizer/"> |
| 46 |
<img alt="Download Count Total" src="https://static.pepy.tech/badge/charset-normalizer/month" /> |
| 47 |
</a> |
| 48 |
<a href="https://bestpractices.coreinfrastructure.org/projects/7297"> |
| 49 |
<img src="https://bestpractices.coreinfrastructure.org/projects/7297/badge"> |
| 50 |
</a> |
| 51 |
</p> |
| 52 |
<p align="center"> |
| 53 |
<sup><i>Featured Packages</i></sup><br> |
| 54 |
<a href="https://github.com/jawah/niquests"> |
| 55 |
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-Best_HTTP_Client-cyan"> |
| 56 |
</a> |
| 57 |
<a href="https://github.com/jawah/wassima"> |
| 58 |
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-Certifi_Killer-cyan"> |
| 59 |
</a> |
| 60 |
</p> |
| 61 |
<p align="center"> |
| 62 |
<sup><i>In other language (unofficial port - by the community)</i></sup><br> |
| 63 |
<a href="https://github.com/nickspring/charset-normalizer-rs"> |
| 64 |
<img alt="Static Badge" src="https://img.shields.io/badge/Rust-red"> |
| 65 |
</a> |
| 66 |
</p> |
| 67 |
|
| 68 |
> A library that helps you read text from an unknown charset encoding.<br /> Motivated by `chardet`, |
| 69 |
> I'm trying to resolve the issue by taking a new approach. |
| 70 |
> All IANA character set names for which the Python core library provides codecs are supported. |
| 71 |
|
| 72 |
<p align="center"> |
| 73 |
>>>>> <a href="https://charsetnormalizerweb.ousret.now.sh" target="_blank">👉 Try Me Online Now, Then Adopt Me 👈 </a> <<<<< |
| 74 |
</p> |
| 75 |
|
| 76 |
This project offers you an alternative to **Universal Charset Encoding Detector**, also known as **Chardet**. |
| 77 |
|
| 78 |
| Feature | [Chardet](https://github.com/chardet/chardet) | Charset Normalizer | [cChardet](https://github.com/PyYoshi/cChardet) | |
| 79 |
|--------------------------------------------------|:---------------------------------------------:|:--------------------------------------------------------------------------------------------------:|:-----------------------------------------------:| |
| 80 |
| `Fast` | ❌ | ✅ | ✅ | |
| 81 |
| `Universal**` | ❌ | ✅ | ❌ | |
| 82 |
| `Reliable` **without** distinguishable standards | ❌ | ✅ | ✅ | |
| 83 |
| `Reliable` **with** distinguishable standards | ✅ | ✅ | ✅ | |
| 84 |
| `License` | LGPL-2.1<br>_restrictive_ | MIT | MPL-1.1<br>_restrictive_ | |
| 85 |
| `Native Python` | ✅ | ✅ | ❌ | |
| 86 |
| `Detect spoken language` | ❌ | ✅ | N/A | |
| 87 |
| `UnicodeDecodeError Safety` | ❌ | ✅ | ❌ | |
| 88 |
| `Whl Size (min)` | 193.6 kB | 42 kB | ~200 kB | |
| 89 |
| `Supported Encoding` | 33 | 🎉 [99](https://charset-normalizer.readthedocs.io/en/latest/user/support.html#supported-encodings) | 40 | |
| 90 |
|
| 91 |
<p align="center"> |
| 92 |
<img src="https://i.imgflip.com/373iay.gif" alt="Reading Normalized Text" width="226"/><img src="https://media.tenor.com/images/c0180f70732a18b4965448d33adba3d0/tenor.gif" alt="Cat Reading Text" width="200"/> |
| 93 |
</p> |
| 94 |
|
| 95 |
*\*\* : They are clearly using specific code for a specific encoding even if covering most of used one*<br> |
| 96 |
|
| 97 |
## ⚡ Performance |
| 98 |
|
| 99 |
This package offer better performance than its counterpart Chardet. Here are some numbers. |
| 100 |
|
| 101 |
| Package | Accuracy | Mean per file (ms) | File per sec (est) | |
| 102 |
|-----------------------------------------------|:--------:|:------------------:|:------------------:| |
| 103 |
| [chardet](https://github.com/chardet/chardet) | 86 % | 63 ms | 16 file/sec | |
| 104 |
| charset-normalizer | **98 %** | **10 ms** | 100 file/sec | |
| 105 |
|
| 106 |
| Package | 99th percentile | 95th percentile | 50th percentile | |
| 107 |
|-----------------------------------------------|:---------------:|:---------------:|:---------------:| |
| 108 |
| [chardet](https://github.com/chardet/chardet) | 265 ms | 71 ms | 7 ms | |
| 109 |
| charset-normalizer | 100 ms | 50 ms | 5 ms | |
| 110 |
|
| 111 |
_updated as of december 2024 using CPython 3.12_ |
| 112 |
|
| 113 |
Chardet's performance on larger file (1MB+) are very poor. Expect huge difference on large payload. |
| 114 |
|
| 115 |
> Stats are generated using 400+ files using default parameters. More details on used files, see GHA workflows. |
| 116 |
> And yes, these results might change at any time. The dataset can be updated to include more files. |
| 117 |
> The actual delays heavily depends on your CPU capabilities. The factors should remain the same. |
| 118 |
> Keep in mind that the stats are generous and that Chardet accuracy vs our is measured using Chardet initial capability |
| 119 |
> (e.g. Supported Encoding) Challenge-them if you want. |
| 120 |
|
| 121 |
## ✨ Installation |
| 122 |
|
| 123 |
Using pip: |
| 124 |
|
| 125 |
```sh |
| 126 |
pip install charset-normalizer -U |
| 127 |
``` |
| 128 |
|
| 129 |
## 🚀 Basic Usage |
| 130 |
|
| 131 |
### CLI |
| 132 |
This package comes with a CLI. |
| 133 |
|
| 134 |
``` |
| 135 |
usage: normalizer [-h] [-v] [-a] [-n] [-m] [-r] [-f] [-t THRESHOLD] |
| 136 |
file [file ...] |
| 137 |
|
| 138 |
The Real First Universal Charset Detector. Discover originating encoding used |
| 139 |
on text file. Normalize text to unicode. |
| 140 |
|
| 141 |
positional arguments: |
| 142 |
files File(s) to be analysed |
| 143 |
|
| 144 |
optional arguments: |
| 145 |
-h, --help show this help message and exit |
| 146 |
-v, --verbose Display complementary information about file if any. |
| 147 |
Stdout will contain logs about the detection process. |
| 148 |
-a, --with-alternative |
| 149 |
Output complementary possibilities if any. Top-level |
| 150 |
JSON WILL be a list. |
| 151 |
-n, --normalize Permit to normalize input file. If not set, program |
| 152 |
does not write anything. |
| 153 |
-m, --minimal Only output the charset detected to STDOUT. Disabling |
| 154 |
JSON output. |
| 155 |
-r, --replace Replace file when trying to normalize it instead of |
| 156 |
creating a new one. |
| 157 |
-f, --force Replace file without asking if you are sure, use this |
| 158 |
flag with caution. |
| 159 |
-t THRESHOLD, --threshold THRESHOLD |
| 160 |
Define a custom maximum amount of chaos allowed in |
| 161 |
decoded content. 0. <= chaos <= 1. |
| 162 |
--version Show version information and exit. |
| 163 |
``` |
| 164 |
|
| 165 |
```bash |
| 166 |
normalizer ./data/sample.1.fr.srt |
| 167 |
``` |
| 168 |
|
| 169 |
or |
| 170 |
|
| 171 |
```bash |
| 172 |
python -m charset_normalizer ./data/sample.1.fr.srt |
| 173 |
``` |
| 174 |
|
| 175 |
🎉 Since version 1.4.0 the CLI produce easily usable stdout result in JSON format. |
| 176 |
|
| 177 |
```json |
| 178 |
{ |
| 179 |
"path": "/home/default/projects/charset_normalizer/data/sample.1.fr.srt", |
| 180 |
"encoding": "cp1252", |
| 181 |
"encoding_aliases": [ |
| 182 |
"1252", |
| 183 |
"windows_1252" |
| 184 |
], |
| 185 |
"alternative_encodings": [ |
| 186 |
"cp1254", |
| 187 |
"cp1256", |
| 188 |
"cp1258", |
| 189 |
"iso8859_14", |
| 190 |
"iso8859_15", |
| 191 |
"iso8859_16", |
| 192 |
"iso8859_3", |
| 193 |
"iso8859_9", |
| 194 |
"latin_1", |
| 195 |
"mbcs" |
| 196 |
], |
| 197 |
"language": "French", |
| 198 |
"alphabets": [ |
| 199 |
"Basic Latin", |
| 200 |
"Latin-1 Supplement" |
| 201 |
], |
| 202 |
"has_sig_or_bom": false, |
| 203 |
"chaos": 0.149, |
| 204 |
"coherence": 97.152, |
| 205 |
"unicode_path": null, |
| 206 |
"is_preferred": true |
| 207 |
} |
| 208 |
``` |
| 209 |
|
| 210 |
### Python |
| 211 |
*Just print out normalized text* |
| 212 |
```python |
| 213 |
from charset_normalizer import from_path |
| 214 |
|
| 215 |
results = from_path('./my_subtitle.srt') |
| 216 |
|
| 217 |
print(str(results.best())) |
| 218 |
``` |
| 219 |
|
| 220 |
*Upgrade your code without effort* |
| 221 |
```python |
| 222 |
from charset_normalizer import detect |
| 223 |
``` |
| 224 |
|
| 225 |
The above code will behave the same as **chardet**. We ensure that we offer the best (reasonable) BC result possible. |
| 226 |
|
| 227 |
See the docs for advanced usage : [readthedocs.io](https://charset-normalizer.readthedocs.io/en/latest/) |
| 228 |
|
| 229 |
## 😇 Why |
| 230 |
|
| 231 |
When I started using Chardet, I noticed that it was not suited to my expectations, and I wanted to propose a |
| 232 |
reliable alternative using a completely different method. Also! I never back down on a good challenge! |
| 233 |
|
| 234 |
I **don't care** about the **originating charset** encoding, because **two different tables** can |
| 235 |
produce **two identical rendered string.** |
| 236 |
What I want is to get readable text, the best I can. |
| 237 |
|
| 238 |
In a way, **I'm brute forcing text decoding.** How cool is that ? 😎 |
| 239 |
|
| 240 |
Don't confuse package **ftfy** with charset-normalizer or chardet. ftfy goal is to repair Unicode string whereas charset-normalizer to convert raw file in unknown encoding to unicode. |
| 241 |
|
| 242 |
## 🍰 How |
| 243 |
|
| 244 |
- Discard all charset encoding table that could not fit the binary content. |
| 245 |
- Measure noise, or the mess once opened (by chunks) with a corresponding charset encoding. |
| 246 |
- Extract matches with the lowest mess detected. |
| 247 |
- Additionally, we measure coherence / probe for a language. |
| 248 |
|
| 249 |
**Wait a minute**, what is noise/mess and coherence according to **YOU ?** |
| 250 |
|
| 251 |
*Noise :* I opened hundred of text files, **written by humans**, with the wrong encoding table. **I observed**, then |
| 252 |
**I established** some ground rules about **what is obvious** when **it seems like** a mess (aka. defining noise in rendered text). |
| 253 |
I know that my interpretation of what is noise is probably incomplete, feel free to contribute in order to |
| 254 |
improve or rewrite it. |
| 255 |
|
| 256 |
*Coherence :* For each language there is on earth, we have computed ranked letter appearance occurrences (the best we can). So I thought |
| 257 |
that intel is worth something here. So I use those records against decoded text to check if I can detect intelligent design. |
| 258 |
|
| 259 |
## ⚡ Known limitations |
| 260 |
|
| 261 |
- Language detection is unreliable when text contains two or more languages sharing identical letters. (eg. HTML (english tags) + Turkish content (Sharing Latin characters)) |
| 262 |
- Every charset detector heavily depends on sufficient content. In common cases, do not bother run detection on very tiny content. |
| 263 |
|
| 264 |
## ⚠️ About Python EOLs |
| 265 |
|
| 266 |
**If you are running:** |
| 267 |
|
| 268 |
- Python >=2.7,<3.5: Unsupported |
| 269 |
- Python 3.5: charset-normalizer < 2.1 |
| 270 |
- Python 3.6: charset-normalizer < 3.1 |
| 271 |
- Python 3.7: charset-normalizer < 4.0 |
| 272 |
|
| 273 |
Upgrade your Python interpreter as soon as possible. |
| 274 |
|
| 275 |
## 👤 Contributing |
| 276 |
|
| 277 |
Contributions, issues and feature requests are very much welcome.<br /> |
| 278 |
Feel free to check [issues page](https://github.com/ousret/charset_normalizer/issues) if you want to contribute. |
| 279 |
|
| 280 |
## 📝 License |
| 281 |
|
| 282 |
Copyright © [Ahmed TAHRI @Ousret](https://github.com/Ousret).<br /> |
| 283 |
This project is [MIT](https://github.com/Ousret/charset_normalizer/blob/master/LICENSE) licensed. |
| 284 |
|
| 285 |
Characters frequencies used in this project © 2012 [Denny Vrandečić](http://simia.net/letters/) |
| 286 |
|
| 287 |
## 💼 For Enterprise |
| 288 |
|
| 289 |
Professional support for charset-normalizer is available as part of the [Tidelift |
| 290 |
Subscription][1]. Tidelift gives software development teams a single source for |
| 291 |
purchasing and maintaining their software, with professional grade assurances |
| 292 |
from the experts who know it best, while seamlessly integrating with existing |
| 293 |
tools. |
| 294 |
|
| 295 |
[1]: https://tidelift.com/subscription/pkg/pypi-charset-normalizer?utm_source=pypi-charset-normalizer&utm_medium=readme |
| 296 |
|
| 297 |
[](https://www.bestpractices.dev/projects/7297) |
| 298 |
|
| 299 |
# Changelog |
| 300 |
All notable changes to charset-normalizer will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 301 |
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). |
| 302 |
|
| 303 |
## [3.4.2](https://github.com/Ousret/charset_normalizer/compare/3.4.1...3.4.2) (2025-05-02) |
| 304 |
|
| 305 |
### Fixed |
| 306 |
- Addressed the DeprecationWarning in our CLI regarding `argparse.FileType` by backporting the target class into the package. (#591) |
| 307 |
- Improved the overall reliability of the detector with CJK Ideographs. (#605) (#587) |
| 308 |
|
| 309 |
### Changed |
| 310 |
- Optional mypyc compilation upgraded to version 1.15 for Python >= 3.8 |
| 311 |
|
| 312 |
## [3.4.1](https://github.com/Ousret/charset_normalizer/compare/3.4.0...3.4.1) (2024-12-24) |
| 313 |
|
| 314 |
### Changed |
| 315 |
- Project metadata are now stored using `pyproject.toml` instead of `setup.cfg` using setuptools as the build backend. |
| 316 |
- Enforce annotation delayed loading for a simpler and consistent types in the project. |
| 317 |
- Optional mypyc compilation upgraded to version 1.14 for Python >= 3.8 |
| 318 |
|
| 319 |
### Added |
| 320 |
- pre-commit configuration. |
| 321 |
- noxfile. |
| 322 |
|
| 323 |
### Removed |
| 324 |
- `build-requirements.txt` as per using `pyproject.toml` native build configuration. |
| 325 |
- `bin/integration.py` and `bin/serve.py` in favor of downstream integration test (see noxfile). |
| 326 |
- `setup.cfg` in favor of `pyproject.toml` metadata configuration. |
| 327 |
- Unused `utils.range_scan` function. |
| 328 |
|
| 329 |
### Fixed |
| 330 |
- Converting content to Unicode bytes may insert `utf_8` instead of preferred `utf-8`. (#572) |
| 331 |
- Deprecation warning "'count' is passed as positional argument" when converting to Unicode bytes on Python 3.13+ |
| 332 |
|
| 333 |
## [3.4.0](https://github.com/Ousret/charset_normalizer/compare/3.3.2...3.4.0) (2024-10-08) |
| 334 |
|
| 335 |
### Added |
| 336 |
- Argument `--no-preemptive` in the CLI to prevent the detector to search for hints. |
| 337 |
- Support for Python 3.13 (#512) |
| 338 |
|
| 339 |
### Fixed |
| 340 |
- Relax the TypeError exception thrown when trying to compare a CharsetMatch with anything else than a CharsetMatch. |
| 341 |
- Improved the general reliability of the detector based on user feedbacks. (#520) (#509) (#498) (#407) (#537) |
| 342 |
- Declared charset in content (preemptive detection) not changed when converting to utf-8 bytes. (#381) |
| 343 |
|
| 344 |
## [3.3.2](https://github.com/Ousret/charset_normalizer/compare/3.3.1...3.3.2) (2023-10-31) |
| 345 |
|
| 346 |
### Fixed |
| 347 |
- Unintentional memory usage regression when using large payload that match several encoding (#376) |
| 348 |
- Regression on some detection case showcased in the documentation (#371) |
| 349 |
|
| 350 |
### Added |
| 351 |
- Noise (md) probe that identify malformed arabic representation due to the presence of letters in isolated form (credit to my wife) |
| 352 |
|
| 353 |
## [3.3.1](https://github.com/Ousret/charset_normalizer/compare/3.3.0...3.3.1) (2023-10-22) |
| 354 |
|
| 355 |
### Changed |
| 356 |
- Optional mypyc compilation upgraded to version 1.6.1 for Python >= 3.8 |
| 357 |
- Improved the general detection reliability based on reports from the community |
| 358 |
|
| 359 |
## [3.3.0](https://github.com/Ousret/charset_normalizer/compare/3.2.0...3.3.0) (2023-09-30) |
| 360 |
|
| 361 |
### Added |
| 362 |
- Allow to execute the CLI (e.g. normalizer) through `python -m charset_normalizer.cli` or `python -m charset_normalizer` |
| 363 |
- Support for 9 forgotten encoding that are supported by Python but unlisted in `encoding.aliases` as they have no alias (#323) |
| 364 |
|
| 365 |
### Removed |
| 366 |
- (internal) Redundant utils.is_ascii function and unused function is_private_use_only |
| 367 |
- (internal) charset_normalizer.assets is moved inside charset_normalizer.constant |
| 368 |
|
| 369 |
### Changed |
| 370 |
- (internal) Unicode code blocks in constants are updated using the latest v15.0.0 definition to improve detection |
| 371 |
- Optional mypyc compilation upgraded to version 1.5.1 for Python >= 3.8 |
| 372 |
|
| 373 |
### Fixed |
| 374 |
- Unable to properly sort CharsetMatch when both chaos/noise and coherence were close due to an unreachable condition in \_\_lt\_\_ (#350) |
| 375 |
|
| 376 |
## [3.2.0](https://github.com/Ousret/charset_normalizer/compare/3.1.0...3.2.0) (2023-06-07) |
| 377 |
|
| 378 |
### Changed |
| 379 |
- Typehint for function `from_path` no longer enforce `PathLike` as its first argument |
| 380 |
- Minor improvement over the global detection reliability |
| 381 |
|
| 382 |
### Added |
| 383 |
- Introduce function `is_binary` that relies on main capabilities, and optimized to detect binaries |
| 384 |
- Propagate `enable_fallback` argument throughout `from_bytes`, `from_path`, and `from_fp` that allow a deeper control over the detection (default True) |
| 385 |
- Explicit support for Python 3.12 |
| 386 |
|
| 387 |
### Fixed |
| 388 |
- Edge case detection failure where a file would contain 'very-long' camel cased word (Issue #289) |
| 389 |
|
| 390 |
## [3.1.0](https://github.com/Ousret/charset_normalizer/compare/3.0.1...3.1.0) (2023-03-06) |
| 391 |
|
| 392 |
### Added |
| 393 |
- Argument `should_rename_legacy` for legacy function `detect` and disregard any new arguments without errors (PR #262) |
| 394 |
|
| 395 |
### Removed |
| 396 |
- Support for Python 3.6 (PR #260) |
| 397 |
|
| 398 |
### Changed |
| 399 |
- Optional speedup provided by mypy/c 1.0.1 |
| 400 |
|
| 401 |
## [3.0.1](https://github.com/Ousret/charset_normalizer/compare/3.0.0...3.0.1) (2022-11-18) |
| 402 |
|
| 403 |
### Fixed |
| 404 |
- Multi-bytes cutter/chunk generator did not always cut correctly (PR #233) |
| 405 |
|
| 406 |
### Changed |
| 407 |
- Speedup provided by mypy/c 0.990 on Python >= 3.7 |
| 408 |
|
| 409 |
## [3.0.0](https://github.com/Ousret/charset_normalizer/compare/2.1.1...3.0.0) (2022-10-20) |
| 410 |
|
| 411 |
### Added |
| 412 |
- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results |
| 413 |
- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES |
| 414 |
- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio |
| 415 |
- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) |
| 416 |
|
| 417 |
### Changed |
| 418 |
- Build with static metadata using 'build' frontend |
| 419 |
- Make the language detection stricter |
| 420 |
- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 |
| 421 |
|
| 422 |
### Fixed |
| 423 |
- CLI with opt --normalize fail when using full path for files |
| 424 |
- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it |
| 425 |
- Sphinx warnings when generating the documentation |
| 426 |
|
| 427 |
### Removed |
| 428 |
- Coherence detector no longer return 'Simple English' instead return 'English' |
| 429 |
- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' |
| 430 |
- Breaking: Method `first()` and `best()` from CharsetMatch |
| 431 |
- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) |
| 432 |
- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches |
| 433 |
- Breaking: Top-level function `normalize` |
| 434 |
- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch |
| 435 |
- Support for the backport `unicodedata2` |
| 436 |
|
| 437 |
## [3.0.0rc1](https://github.com/Ousret/charset_normalizer/compare/3.0.0b2...3.0.0rc1) (2022-10-18) |
| 438 |
|
| 439 |
### Added |
| 440 |
- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results |
| 441 |
- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES |
| 442 |
- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio |
| 443 |
|
| 444 |
### Changed |
| 445 |
- Build with static metadata using 'build' frontend |
| 446 |
- Make the language detection stricter |
| 447 |
|
| 448 |
### Fixed |
| 449 |
- CLI with opt --normalize fail when using full path for files |
| 450 |
- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it |
| 451 |
|
| 452 |
### Removed |
| 453 |
- Coherence detector no longer return 'Simple English' instead return 'English' |
| 454 |
- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' |
| 455 |
|
| 456 |
## [3.0.0b2](https://github.com/Ousret/charset_normalizer/compare/3.0.0b1...3.0.0b2) (2022-08-21) |
| 457 |
|
| 458 |
### Added |
| 459 |
- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) |
| 460 |
|
| 461 |
### Removed |
| 462 |
- Breaking: Method `first()` and `best()` from CharsetMatch |
| 463 |
- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) |
| 464 |
|
| 465 |
### Fixed |
| 466 |
- Sphinx warnings when generating the documentation |
| 467 |
|
| 468 |
## [3.0.0b1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...3.0.0b1) (2022-08-15) |
| 469 |
|
| 470 |
### Changed |
| 471 |
- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 |
| 472 |
|
| 473 |
### Removed |
| 474 |
- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches |
| 475 |
- Breaking: Top-level function `normalize` |
| 476 |
- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch |
| 477 |
- Support for the backport `unicodedata2` |
| 478 |
|
| 479 |
## [2.1.1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...2.1.1) (2022-08-19) |
| 480 |
|
| 481 |
### Deprecated |
| 482 |
- Function `normalize` scheduled for removal in 3.0 |
| 483 |
|
| 484 |
### Changed |
| 485 |
- Removed useless call to decode in fn is_unprintable (#206) |
| 486 |
|
| 487 |
### Fixed |
| 488 |
- Third-party library (i18n xgettext) crashing not recognizing utf_8 (PEP 263) with underscore from [@aleksandernovikov](https://github.com/aleksandernovikov) (#204) |
| 489 |
|
| 490 |
## [2.1.0](https://github.com/Ousret/charset_normalizer/compare/2.0.12...2.1.0) (2022-06-19) |
| 491 |
|
| 492 |
### Added |
| 493 |
- Output the Unicode table version when running the CLI with `--version` (PR #194) |
| 494 |
|
| 495 |
### Changed |
| 496 |
- Re-use decoded buffer for single byte character sets from [@nijel](https://github.com/nijel) (PR #175) |
| 497 |
- Fixing some performance bottlenecks from [@deedy5](https://github.com/deedy5) (PR #183) |
| 498 |
|
| 499 |
### Fixed |
| 500 |
- Workaround potential bug in cpython with Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space (PR #175) |
| 501 |
- CLI default threshold aligned with the API threshold from [@oleksandr-kuzmenko](https://github.com/oleksandr-kuzmenko) (PR #181) |
| 502 |
|
| 503 |
### Removed |
| 504 |
- Support for Python 3.5 (PR #192) |
| 505 |
|
| 506 |
### Deprecated |
| 507 |
- Use of backport unicodedata from `unicodedata2` as Python is quickly catching up, scheduled for removal in 3.0 (PR #194) |
| 508 |
|
| 509 |
## [2.0.12](https://github.com/Ousret/charset_normalizer/compare/2.0.11...2.0.12) (2022-02-12) |
| 510 |
|
| 511 |
### Fixed |
| 512 |
- ASCII miss-detection on rare cases (PR #170) |
| 513 |
|
| 514 |
## [2.0.11](https://github.com/Ousret/charset_normalizer/compare/2.0.10...2.0.11) (2022-01-30) |
| 515 |
|
| 516 |
### Added |
| 517 |
- Explicit support for Python 3.11 (PR #164) |
| 518 |
|
| 519 |
### Changed |
| 520 |
- The logging behavior have been completely reviewed, now using only TRACE and DEBUG levels (PR #163 #165) |
| 521 |
|
| 522 |
## [2.0.10](https://github.com/Ousret/charset_normalizer/compare/2.0.9...2.0.10) (2022-01-04) |
| 523 |
|
| 524 |
### Fixed |
| 525 |
- Fallback match entries might lead to UnicodeDecodeError for large bytes sequence (PR #154) |
| 526 |
|
| 527 |
### Changed |
| 528 |
- Skipping the language-detection (CD) on ASCII (PR #155) |
| 529 |
|
| 530 |
## [2.0.9](https://github.com/Ousret/charset_normalizer/compare/2.0.8...2.0.9) (2021-12-03) |
| 531 |
|
| 532 |
### Changed |
| 533 |
- Moderating the logging impact (since 2.0.8) for specific environments (PR #147) |
| 534 |
|
| 535 |
### Fixed |
| 536 |
- Wrong logging level applied when setting kwarg `explain` to True (PR #146) |
| 537 |
|
| 538 |
## [2.0.8](https://github.com/Ousret/charset_normalizer/compare/2.0.7...2.0.8) (2021-11-24) |
| 539 |
### Changed |
| 540 |
- Improvement over Vietnamese detection (PR #126) |
| 541 |
- MD improvement on trailing data and long foreign (non-pure latin) data (PR #124) |
| 542 |
- Efficiency improvements in cd/alphabet_languages from [@adbar](https://github.com/adbar) (PR #122) |
| 543 |
- call sum() without an intermediary list following PEP 289 recommendations from [@adbar](https://github.com/adbar) (PR #129) |
| 544 |
- Code style as refactored by Sourcery-AI (PR #131) |
| 545 |
- Minor adjustment on the MD around european words (PR #133) |
| 546 |
- Remove and replace SRTs from assets / tests (PR #139) |
| 547 |
- Initialize the library logger with a `NullHandler` by default from [@nmaynes](https://github.com/nmaynes) (PR #135) |
| 548 |
- Setting kwarg `explain` to True will add provisionally (bounded to function lifespan) a specific stream handler (PR #135) |
| 549 |
|
| 550 |
### Fixed |
| 551 |
- Fix large (misleading) sequence giving UnicodeDecodeError (PR #137) |
| 552 |
- Avoid using too insignificant chunk (PR #137) |
| 553 |
|
| 554 |
### Added |
| 555 |
- Add and expose function `set_logging_handler` to configure a specific StreamHandler from [@nmaynes](https://github.com/nmaynes) (PR #135) |
| 556 |
- Add `CHANGELOG.md` entries, format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) (PR #141) |
| 557 |
|
| 558 |
## [2.0.7](https://github.com/Ousret/charset_normalizer/compare/2.0.6...2.0.7) (2021-10-11) |
| 559 |
### Added |
| 560 |
- Add support for Kazakh (Cyrillic) language detection (PR #109) |
| 561 |
|
| 562 |
### Changed |
| 563 |
- Further, improve inferring the language from a given single-byte code page (PR #112) |
| 564 |
- Vainly trying to leverage PEP263 when PEP3120 is not supported (PR #116) |
| 565 |
- Refactoring for potential performance improvements in loops from [@adbar](https://github.com/adbar) (PR #113) |
| 566 |
- Various detection improvement (MD+CD) (PR #117) |
| 567 |
|
| 568 |
### Removed |
| 569 |
- Remove redundant logging entry about detected language(s) (PR #115) |
| 570 |
|
| 571 |
### Fixed |
| 572 |
- Fix a minor inconsistency between Python 3.5 and other versions regarding language detection (PR #117 #102) |
| 573 |
|
| 574 |
## [2.0.6](https://github.com/Ousret/charset_normalizer/compare/2.0.5...2.0.6) (2021-09-18) |
| 575 |
### Fixed |
| 576 |
- Unforeseen regression with the loss of the backward-compatibility with some older minor of Python 3.5.x (PR #100) |
| 577 |
- Fix CLI crash when using --minimal output in certain cases (PR #103) |
| 578 |
|
| 579 |
### Changed |
| 580 |
- Minor improvement to the detection efficiency (less than 1%) (PR #106 #101) |
| 581 |
|
| 582 |
## [2.0.5](https://github.com/Ousret/charset_normalizer/compare/2.0.4...2.0.5) (2021-09-14) |
| 583 |
### Changed |
| 584 |
- The project now comply with: flake8, mypy, isort and black to ensure a better overall quality (PR #81) |
| 585 |
- The BC-support with v1.x was improved, the old staticmethods are restored (PR #82) |
| 586 |
- The Unicode detection is slightly improved (PR #93) |
| 587 |
- Add syntax sugar \_\_bool\_\_ for results CharsetMatches list-container (PR #91) |
| 588 |
|
| 589 |
### Removed |
| 590 |
- The project no longer raise warning on tiny content given for detection, will be simply logged as warning instead (PR #92) |
| 591 |
|
| 592 |
### Fixed |
| 593 |
- In some rare case, the chunks extractor could cut in the middle of a multi-byte character and could mislead the mess detection (PR #95) |
| 594 |
- Some rare 'space' characters could trip up the UnprintablePlugin/Mess detection (PR #96) |
| 595 |
- The MANIFEST.in was not exhaustive (PR #78) |
| 596 |
|
| 597 |
## [2.0.4](https://github.com/Ousret/charset_normalizer/compare/2.0.3...2.0.4) (2021-07-30) |
| 598 |
### Fixed |
| 599 |
- The CLI no longer raise an unexpected exception when no encoding has been found (PR #70) |
| 600 |
- Fix accessing the 'alphabets' property when the payload contains surrogate characters (PR #68) |
| 601 |
- The logger could mislead (explain=True) on detected languages and the impact of one MBCS match (PR #72) |
| 602 |
- Submatch factoring could be wrong in rare edge cases (PR #72) |
| 603 |
- Multiple files given to the CLI were ignored when publishing results to STDOUT. (After the first path) (PR #72) |
| 604 |
- Fix line endings from CRLF to LF for certain project files (PR #67) |
| 605 |
|
| 606 |
### Changed |
| 607 |
- Adjust the MD to lower the sensitivity, thus improving the global detection reliability (PR #69 #76) |
| 608 |
- Allow fallback on specified encoding if any (PR #71) |
| 609 |
|
| 610 |
## [2.0.3](https://github.com/Ousret/charset_normalizer/compare/2.0.2...2.0.3) (2021-07-16) |
| 611 |
### Changed |
| 612 |
- Part of the detection mechanism has been improved to be less sensitive, resulting in more accurate detection results. Especially ASCII. (PR #63) |
| 613 |
- According to the community wishes, the detection will fall back on ASCII or UTF-8 in a last-resort case. (PR #64) |
| 614 |
|
| 615 |
## [2.0.2](https://github.com/Ousret/charset_normalizer/compare/2.0.1...2.0.2) (2021-07-15) |
| 616 |
### Fixed |
| 617 |
- Empty/Too small JSON payload miss-detection fixed. Report from [@tseaver](https://github.com/tseaver) (PR #59) |
| 618 |
|
| 619 |
### Changed |
| 620 |
- Don't inject unicodedata2 into sys.modules from [@akx](https://github.com/akx) (PR #57) |
| 621 |
|
| 622 |
## [2.0.1](https://github.com/Ousret/charset_normalizer/compare/2.0.0...2.0.1) (2021-07-13) |
| 623 |
### Fixed |
| 624 |
- Make it work where there isn't a filesystem available, dropping assets frequencies.json. Report from [@sethmlarson](https://github.com/sethmlarson). (PR #55) |
| 625 |
- Using explain=False permanently disable the verbose output in the current runtime (PR #47) |
| 626 |
- One log entry (language target preemptive) was not show in logs when using explain=True (PR #47) |
| 627 |
- Fix undesired exception (ValueError) on getitem of instance CharsetMatches (PR #52) |
| 628 |
|
| 629 |
### Changed |
| 630 |
- Public function normalize default args values were not aligned with from_bytes (PR #53) |
| 631 |
|
| 632 |
### Added |
| 633 |
- You may now use charset aliases in cp_isolation and cp_exclusion arguments (PR #47) |
| 634 |
|
| 635 |
## [2.0.0](https://github.com/Ousret/charset_normalizer/compare/1.4.1...2.0.0) (2021-07-02) |
| 636 |
### Changed |
| 637 |
- 4x to 5 times faster than the previous 1.4.0 release. At least 2x faster than Chardet. |
| 638 |
- Accent has been made on UTF-8 detection, should perform rather instantaneous. |
| 639 |
- The backward compatibility with Chardet has been greatly improved. The legacy detect function returns an identical charset name whenever possible. |
| 640 |
- The detection mechanism has been slightly improved, now Turkish content is detected correctly (most of the time) |
| 641 |
- The program has been rewritten to ease the readability and maintainability. (+Using static typing)+ |
| 642 |
- utf_7 detection has been reinstated. |
| 643 |
|
| 644 |
### Removed |
| 645 |
- This package no longer require anything when used with Python 3.5 (Dropped cached_property) |
| 646 |
- Removed support for these languages: Catalan, Esperanto, Kazakh, Baque, Volapük, Azeri, Galician, Nynorsk, Macedonian, and Serbocroatian. |
| 647 |
- The exception hook on UnicodeDecodeError has been removed. |
| 648 |
|
| 649 |
### Deprecated |
| 650 |
- Methods coherence_non_latin, w_counter, chaos_secondary_pass of the class CharsetMatch are now deprecated and scheduled for removal in v3.0 |
| 651 |
|
| 652 |
### Fixed |
| 653 |
- The CLI output used the relative path of the file(s). Should be absolute. |
| 654 |
|
| 655 |
## [1.4.1](https://github.com/Ousret/charset_normalizer/compare/1.4.0...1.4.1) (2021-05-28) |
| 656 |
### Fixed |
| 657 |
- Logger configuration/usage no longer conflict with others (PR #44) |
| 658 |
|
| 659 |
## [1.4.0](https://github.com/Ousret/charset_normalizer/compare/1.3.9...1.4.0) (2021-05-21) |
| 660 |
### Removed |
| 661 |
- Using standard logging instead of using the package loguru. |
| 662 |
- Dropping nose test framework in favor of the maintained pytest. |
| 663 |
- Choose to not use dragonmapper package to help with gibberish Chinese/CJK text. |
| 664 |
- Require cached_property only for Python 3.5 due to constraint. Dropping for every other interpreter version. |
| 665 |
- Stop support for UTF-7 that does not contain a SIG. |
| 666 |
- Dropping PrettyTable, replaced with pure JSON output in CLI. |
| 667 |
|
| 668 |
### Fixed |
| 669 |
- BOM marker in a CharsetNormalizerMatch instance could be False in rare cases even if obviously present. Due to the sub-match factoring process. |
| 670 |
- Not searching properly for the BOM when trying utf32/16 parent codec. |
| 671 |
|
| 672 |
### Changed |
| 673 |
- Improving the package final size by compressing frequencies.json. |
| 674 |
- Huge improvement over the larges payload. |
| 675 |
|
| 676 |
### Added |
| 677 |
- CLI now produces JSON consumable output. |
| 678 |
- Return ASCII if given sequences fit. Given reasonable confidence. |
| 679 |
|
| 680 |
## [1.3.9](https://github.com/Ousret/charset_normalizer/compare/1.3.8...1.3.9) (2021-05-13) |
| 681 |
|
| 682 |
### Fixed |
| 683 |
- In some very rare cases, you may end up getting encode/decode errors due to a bad bytes payload (PR #40) |
| 684 |
|
| 685 |
## [1.3.8](https://github.com/Ousret/charset_normalizer/compare/1.3.7...1.3.8) (2021-05-12) |
| 686 |
|
| 687 |
### Fixed |
| 688 |
- Empty given payload for detection may cause an exception if trying to access the `alphabets` property. (PR #39) |
| 689 |
|
| 690 |
## [1.3.7](https://github.com/Ousret/charset_normalizer/compare/1.3.6...1.3.7) (2021-05-12) |
| 691 |
|
| 692 |
### Fixed |
| 693 |
- The legacy detect function should return UTF-8-SIG if sig is present in the payload. (PR #38) |
| 694 |
|
| 695 |
## [1.3.6](https://github.com/Ousret/charset_normalizer/compare/1.3.5...1.3.6) (2021-02-09) |
| 696 |
|
| 697 |
### Changed |
| 698 |
- Amend the previous release to allow prettytable 2.0 (PR #35) |
| 699 |
|
| 700 |
## [1.3.5](https://github.com/Ousret/charset_normalizer/compare/1.3.4...1.3.5) (2021-02-08) |
| 701 |
|
| 702 |
### Fixed |
| 703 |
- Fix error while using the package with a python pre-release interpreter (PR #33) |
| 704 |
|
| 705 |
### Changed |
| 706 |
- Dependencies refactoring, constraints revised. |
| 707 |
|
| 708 |
### Added |
| 709 |
- Add python 3.9 and 3.10 to the supported interpreters |
| 710 |
|
| 711 |
MIT License |
| 712 |
|
| 713 |
Copyright (c) 2025 TAHRI Ahmed R. |
| 714 |
|
| 715 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 716 |
of this software and associated documentation files (the "Software"), to deal |
| 717 |
in the Software without restriction, including without limitation the rights |
| 718 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 719 |
copies of the Software, and to permit persons to whom the Software is |
| 720 |
furnished to do so, subject to the following conditions: |
| 721 |
|
| 722 |
The above copyright notice and this permission notice shall be included in all |
| 723 |
copies or substantial portions of the Software. |
| 724 |
|
| 725 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 726 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 727 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 728 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 729 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 730 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 731 |
SOFTWARE. |