charset-normalizer 3.4.2__tar.gz → 3.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/CHANGELOG.md +19 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/MANIFEST.in +4 -1
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/PKG-INFO +23 -4
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/README.md +2 -2
- charset_normalizer-3.4.3/_mypyc_hook/backend.py +34 -0
- charset_normalizer-3.4.3/dev-requirements.txt +2 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/noxfile.py +1 -1
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/pyproject.toml +5 -4
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/setup.py +5 -6
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/api.py +3 -2
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/legacy.py +17 -1
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/version.py +1 -1
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/PKG-INFO +23 -4
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/SOURCES.txt +2 -10
- charset_normalizer-3.4.3/src/charset_normalizer.egg-info/entry_points.txt +2 -0
- charset_normalizer-3.4.3/tests/__init__.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_base_detection.py +24 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_detect_legacy.py +17 -0
- charset_normalizer-3.4.2/.github/CODEOWNERS +0 -9
- charset_normalizer-3.4.2/.github/FUNDING.yml +0 -4
- charset_normalizer-3.4.2/.github/ISSUE_TEMPLATE/bug_report.md +0 -28
- charset_normalizer-3.4.2/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- charset_normalizer-3.4.2/.github/ISSUE_TEMPLATE/wrong_charset.md +0 -39
- charset_normalizer-3.4.2/.github/dependabot.yml +0 -16
- charset_normalizer-3.4.2/.github/workflows/cd.yml +0 -159
- charset_normalizer-3.4.2/.github/workflows/ci.yml +0 -234
- charset_normalizer-3.4.2/.github/workflows/codeql.yml +0 -57
- charset_normalizer-3.4.2/.github/workflows/scorecards.yml +0 -71
- charset_normalizer-3.4.2/dev-requirements.txt +0 -2
- charset_normalizer-3.4.2/src/charset_normalizer.egg-info/entry_points.txt +0 -2
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/.coveragerc +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/.gitignore +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/.pre-commit-config.yaml +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/.readthedocs.yaml +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/CODE_OF_CONDUCT.md +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/CONTRIBUTING.md +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/LICENSE +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/SECURITY.md +0 -0
- {charset_normalizer-3.4.2/tests → charset_normalizer-3.4.3/_mypyc_hook}/__init__.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/bin/bc.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/bin/coverage.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/bin/performance.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/NOTICE.md +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-arabic-1.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-arabic.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-bulgarian.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-chinese.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-english.bom.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-french-1.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-french.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-greek-2.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-greek.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-hebrew-2.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-hebrew-3.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-korean.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-polish.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-russian-2.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-russian-3.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-russian.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-spanish.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/data/sample-turkish.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/Makefile +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/api.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/community/faq.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/community/featured.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/community/speedup.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/community/why_migrate.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/conf.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/index.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/make.bat +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/requirements.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/user/advanced_search.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/user/cli.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/user/getstarted.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/user/handling_result.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/user/miscellaneous.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/docs/user/support.rst +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/setup.cfg +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/__init__.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/__main__.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/cd.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/cli/__init__.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/cli/__main__.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/constant.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/md.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/models.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/py.typed +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer/utils.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/dependency_links.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/requires.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/top_level.txt +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_cli.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_coherence_detection.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_edge_case.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_full_detection.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_isbinary.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_large_payload.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_logging.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_mess_detection.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_preemptive_detection.py +0 -0
- {charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/tests/test_utils.py +0 -0
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
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).
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.4.3](https://github.com/Ousret/charset_normalizer/compare/3.4.2...3.4.3) (2025-08-09)
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- mypy(c) is no longer a required dependency at build time if `CHARSET_NORMALIZER_USE_MYPYC` isn't set to `1`. (#595) (#583)
|
|
9
|
+
- automatically lower confidence on small bytes samples that are not Unicode in `detect` output legacy function. (#391)
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Custom build backend to overcome inability to mark mypy as an optional dependency in the build phase.
|
|
13
|
+
- Support for Python 3.14
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- sdist archive contained useless directories.
|
|
17
|
+
- automatically fallback on valid UTF-16 or UTF-32 even if the md says it's noisy. (#633)
|
|
18
|
+
|
|
19
|
+
### Misc
|
|
20
|
+
- SBOM are automatically published to the relevant GitHub release to comply with regulatory changes.
|
|
21
|
+
Each published wheel comes with its SBOM. We choose CycloneDX as the format.
|
|
22
|
+
- Prebuilt optimized wheel are no longer distributed by default for CPython 3.7 due to a change in cibuildwheel.
|
|
23
|
+
|
|
5
24
|
## [3.4.2](https://github.com/Ousret/charset_normalizer/compare/3.4.1...3.4.2) (2025-05-02)
|
|
6
25
|
|
|
7
26
|
### Fixed
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
include LICENSE README.md CHANGELOG.md src/charset_normalizer/py.typed dev-requirements.txt SECURITY.md noxfile.py
|
|
1
|
+
include LICENSE README.md CHANGELOG.md src/charset_normalizer/py.typed dev-requirements.txt SECURITY.md noxfile.py _mypyc_hook/*.py
|
|
2
2
|
recursive-include data *.md
|
|
3
3
|
recursive-include data *.txt
|
|
4
4
|
recursive-include docs *
|
|
5
5
|
recursive-include tests *
|
|
6
|
+
recursive-exclude .github/ *
|
|
7
|
+
recursive-exclude __pycache__/ *
|
|
8
|
+
global-exclude *.pyc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: charset-normalizer
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.3
|
|
4
4
|
Summary: The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
|
|
5
5
|
Author-email: "Ahmed R. TAHRI" <tahri.ahmed@proton.me>
|
|
6
6
|
Maintainer-email: "Ahmed R. TAHRI" <tahri.ahmed@proton.me>
|
|
@@ -12,7 +12,6 @@ Project-URL: Issue tracker, https://github.com/jawah/charset_normalizer/issues
|
|
|
12
12
|
Keywords: encoding,charset,charset-detector,detector,normalization,unicode,chardet,detect
|
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
15
|
Classifier: Operating System :: OS Independent
|
|
17
16
|
Classifier: Programming Language :: Python
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -23,6 +22,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
26
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
27
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
28
28
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -52,10 +52,10 @@ Dynamic: license-file
|
|
|
52
52
|
<p align="center">
|
|
53
53
|
<sup><i>Featured Packages</i></sup><br>
|
|
54
54
|
<a href="https://github.com/jawah/niquests">
|
|
55
|
-
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-
|
|
55
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-Most_Advanced_HTTP_Client-cyan">
|
|
56
56
|
</a>
|
|
57
57
|
<a href="https://github.com/jawah/wassima">
|
|
58
|
-
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-
|
|
58
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-Certifi_Replacement-cyan">
|
|
59
59
|
</a>
|
|
60
60
|
</p>
|
|
61
61
|
<p align="center">
|
|
@@ -300,6 +300,25 @@ tools.
|
|
|
300
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
301
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
302
302
|
|
|
303
|
+
## [3.4.3](https://github.com/Ousret/charset_normalizer/compare/3.4.2...3.4.3) (2025-08-09)
|
|
304
|
+
|
|
305
|
+
### Changed
|
|
306
|
+
- mypy(c) is no longer a required dependency at build time if `CHARSET_NORMALIZER_USE_MYPYC` isn't set to `1`. (#595) (#583)
|
|
307
|
+
- automatically lower confidence on small bytes samples that are not Unicode in `detect` output legacy function. (#391)
|
|
308
|
+
|
|
309
|
+
### Added
|
|
310
|
+
- Custom build backend to overcome inability to mark mypy as an optional dependency in the build phase.
|
|
311
|
+
- Support for Python 3.14
|
|
312
|
+
|
|
313
|
+
### Fixed
|
|
314
|
+
- sdist archive contained useless directories.
|
|
315
|
+
- automatically fallback on valid UTF-16 or UTF-32 even if the md says it's noisy. (#633)
|
|
316
|
+
|
|
317
|
+
### Misc
|
|
318
|
+
- SBOM are automatically published to the relevant GitHub release to comply with regulatory changes.
|
|
319
|
+
Each published wheel comes with its SBOM. We choose CycloneDX as the format.
|
|
320
|
+
- Prebuilt optimized wheel are no longer distributed by default for CPython 3.7 due to a change in cibuildwheel.
|
|
321
|
+
|
|
303
322
|
## [3.4.2](https://github.com/Ousret/charset_normalizer/compare/3.4.1...3.4.2) (2025-05-02)
|
|
304
323
|
|
|
305
324
|
### Fixed
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
<p align="center">
|
|
16
16
|
<sup><i>Featured Packages</i></sup><br>
|
|
17
17
|
<a href="https://github.com/jawah/niquests">
|
|
18
|
-
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-
|
|
18
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-Most_Advanced_HTTP_Client-cyan">
|
|
19
19
|
</a>
|
|
20
20
|
<a href="https://github.com/jawah/wassima">
|
|
21
|
-
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-
|
|
21
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-Certifi_Replacement-cyan">
|
|
22
22
|
</a>
|
|
23
23
|
</p>
|
|
24
24
|
<p align="center">
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from setuptools import build_meta as _orig # type: ignore[import-not-found]
|
|
7
|
+
|
|
8
|
+
USE_MYPYC = os.getenv("CHARSET_NORMALIZER_USE_MYPYC", "0") == "1"
|
|
9
|
+
MYPYC_SPEC = "mypy>=1.4.1,<=1.17.1"
|
|
10
|
+
|
|
11
|
+
# Expose all the PEP 517 hooks from setuptools
|
|
12
|
+
get_requires_for_build_sdist = _orig.get_requires_for_build_sdist
|
|
13
|
+
prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
|
|
14
|
+
build_wheel = _orig.build_wheel
|
|
15
|
+
build_sdist = _orig.build_sdist
|
|
16
|
+
|
|
17
|
+
if hasattr(_orig, "get_requires_for_build_editable"):
|
|
18
|
+
get_requires_for_build_editable = _orig.get_requires_for_build_editable
|
|
19
|
+
if hasattr(_orig, "prepare_metadata_for_build_editable"):
|
|
20
|
+
prepare_metadata_for_build_editable = _orig.prepare_metadata_for_build_editable
|
|
21
|
+
if hasattr(_orig, "build_editable"):
|
|
22
|
+
build_editable = _orig.build_editable
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Override the build requirements function to conditionally add Cython
|
|
26
|
+
def get_requires_for_build_wheel(
|
|
27
|
+
config_settings: dict[str, Any] | None = None,
|
|
28
|
+
) -> list[str]:
|
|
29
|
+
"""Get the build requirements, conditionally adding Mypy(C)."""
|
|
30
|
+
requires = _orig.get_requires_for_build_wheel(config_settings)
|
|
31
|
+
if USE_MYPYC and MYPYC_SPEC not in requires:
|
|
32
|
+
requires = list(requires) if requires else []
|
|
33
|
+
requires.append(MYPYC_SPEC)
|
|
34
|
+
return requires # type: ignore[no-any-return]
|
|
@@ -59,7 +59,7 @@ def test(session: nox.Session) -> None:
|
|
|
59
59
|
test_impl(session)
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"])
|
|
62
|
+
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"])
|
|
63
63
|
def test_mypyc(session: nox.Session) -> None:
|
|
64
64
|
test_impl(session, True)
|
|
65
65
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools", "setuptools-scm"
|
|
3
|
-
build-backend = "
|
|
2
|
+
requires = ["setuptools", "setuptools-scm"]
|
|
3
|
+
build-backend = "backend"
|
|
4
|
+
backend-path = ["_mypyc_hook"]
|
|
4
5
|
|
|
5
6
|
[project]
|
|
6
7
|
name = "charset-normalizer"
|
|
@@ -16,7 +17,6 @@ maintainers = [
|
|
|
16
17
|
classifiers = [
|
|
17
18
|
"Development Status :: 5 - Production/Stable",
|
|
18
19
|
"Intended Audience :: Developers",
|
|
19
|
-
"License :: OSI Approved :: MIT License",
|
|
20
20
|
"Operating System :: OS Independent",
|
|
21
21
|
"Programming Language :: Python",
|
|
22
22
|
"Programming Language :: Python :: 3",
|
|
@@ -27,6 +27,7 @@ classifiers = [
|
|
|
27
27
|
"Programming Language :: Python :: 3.11",
|
|
28
28
|
"Programming Language :: Python :: 3.12",
|
|
29
29
|
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
30
31
|
"Programming Language :: Python :: 3 :: Only",
|
|
31
32
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
32
33
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
@@ -49,7 +50,7 @@ version = {attr = "charset_normalizer.__version__"}
|
|
|
49
50
|
readme = {file = ["README.md", "CHANGELOG.md", "LICENSE"], content-type = "text/markdown"}
|
|
50
51
|
|
|
51
52
|
[project.scripts]
|
|
52
|
-
normalizer = "charset_normalizer:
|
|
53
|
+
normalizer = "charset_normalizer.cli:cli_detect"
|
|
53
54
|
|
|
54
55
|
[project.urls]
|
|
55
56
|
"Changelog" = "https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md"
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
|
-
import sys
|
|
6
5
|
|
|
7
6
|
from setuptools import setup
|
|
8
7
|
|
|
9
8
|
USE_MYPYC = False
|
|
10
9
|
|
|
11
|
-
if
|
|
12
|
-
sys.argv.pop(1)
|
|
13
|
-
USE_MYPYC = True
|
|
14
|
-
elif os.getenv("CHARSET_NORMALIZER_USE_MYPYC", None) == "1":
|
|
10
|
+
if os.getenv("CHARSET_NORMALIZER_USE_MYPYC", None) == "1":
|
|
15
11
|
USE_MYPYC = True
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
try:
|
|
18
14
|
from mypyc.build import mypycify
|
|
15
|
+
except ImportError:
|
|
16
|
+
mypycify = None # type: ignore[assignment]
|
|
19
17
|
|
|
18
|
+
if USE_MYPYC and mypycify is not None:
|
|
20
19
|
MYPYC_MODULES = mypycify(
|
|
21
20
|
[
|
|
22
21
|
"src/charset_normalizer/md.py",
|
|
@@ -369,14 +369,15 @@ def from_bytes(
|
|
|
369
369
|
# Preparing those fallbacks in case we got nothing.
|
|
370
370
|
if (
|
|
371
371
|
enable_fallback
|
|
372
|
-
and encoding_iana
|
|
372
|
+
and encoding_iana
|
|
373
|
+
in ["ascii", "utf_8", specified_encoding, "utf_16", "utf_32"]
|
|
373
374
|
and not lazy_str_hard_failure
|
|
374
375
|
):
|
|
375
376
|
fallback_entry = CharsetMatch(
|
|
376
377
|
sequences,
|
|
377
378
|
encoding_iana,
|
|
378
379
|
threshold,
|
|
379
|
-
|
|
380
|
+
bom_or_sig_available,
|
|
380
381
|
[],
|
|
381
382
|
decoded_payload,
|
|
382
383
|
preemptive_declaration=specified_encoding,
|
|
@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Any
|
|
|
4
4
|
from warnings import warn
|
|
5
5
|
|
|
6
6
|
from .api import from_bytes
|
|
7
|
-
from .constant import CHARDET_CORRESPONDENCE
|
|
7
|
+
from .constant import CHARDET_CORRESPONDENCE, TOO_SMALL_SEQUENCE
|
|
8
8
|
|
|
9
9
|
# TODO: remove this check when dropping Python 3.7 support
|
|
10
10
|
if TYPE_CHECKING:
|
|
@@ -49,6 +49,22 @@ def detect(
|
|
|
49
49
|
language = r.language if r is not None and r.language != "Unknown" else ""
|
|
50
50
|
confidence = 1.0 - r.chaos if r is not None else None
|
|
51
51
|
|
|
52
|
+
# automatically lower confidence
|
|
53
|
+
# on small bytes samples.
|
|
54
|
+
# https://github.com/jawah/charset_normalizer/issues/391
|
|
55
|
+
if (
|
|
56
|
+
confidence is not None
|
|
57
|
+
and confidence >= 0.9
|
|
58
|
+
and encoding
|
|
59
|
+
not in {
|
|
60
|
+
"utf_8",
|
|
61
|
+
"ascii",
|
|
62
|
+
}
|
|
63
|
+
and r.bom is False # type: ignore[union-attr]
|
|
64
|
+
and len(byte_str) < TOO_SMALL_SEQUENCE
|
|
65
|
+
):
|
|
66
|
+
confidence -= 0.2
|
|
67
|
+
|
|
52
68
|
# Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process
|
|
53
69
|
# but chardet does return 'utf-8-sig' and it is a valid codec name.
|
|
54
70
|
if r is not None and encoding == "utf_8" and r.bom:
|
{charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: charset-normalizer
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.3
|
|
4
4
|
Summary: The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
|
|
5
5
|
Author-email: "Ahmed R. TAHRI" <tahri.ahmed@proton.me>
|
|
6
6
|
Maintainer-email: "Ahmed R. TAHRI" <tahri.ahmed@proton.me>
|
|
@@ -12,7 +12,6 @@ Project-URL: Issue tracker, https://github.com/jawah/charset_normalizer/issues
|
|
|
12
12
|
Keywords: encoding,charset,charset-detector,detector,normalization,unicode,chardet,detect
|
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
16
15
|
Classifier: Operating System :: OS Independent
|
|
17
16
|
Classifier: Programming Language :: Python
|
|
18
17
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -23,6 +22,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
26
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
27
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
28
28
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -52,10 +52,10 @@ Dynamic: license-file
|
|
|
52
52
|
<p align="center">
|
|
53
53
|
<sup><i>Featured Packages</i></sup><br>
|
|
54
54
|
<a href="https://github.com/jawah/niquests">
|
|
55
|
-
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-
|
|
55
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/Niquests-Most_Advanced_HTTP_Client-cyan">
|
|
56
56
|
</a>
|
|
57
57
|
<a href="https://github.com/jawah/wassima">
|
|
58
|
-
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-
|
|
58
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/Wassima-Certifi_Replacement-cyan">
|
|
59
59
|
</a>
|
|
60
60
|
</p>
|
|
61
61
|
<p align="center">
|
|
@@ -300,6 +300,25 @@ tools.
|
|
|
300
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
301
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
302
302
|
|
|
303
|
+
## [3.4.3](https://github.com/Ousret/charset_normalizer/compare/3.4.2...3.4.3) (2025-08-09)
|
|
304
|
+
|
|
305
|
+
### Changed
|
|
306
|
+
- mypy(c) is no longer a required dependency at build time if `CHARSET_NORMALIZER_USE_MYPYC` isn't set to `1`. (#595) (#583)
|
|
307
|
+
- automatically lower confidence on small bytes samples that are not Unicode in `detect` output legacy function. (#391)
|
|
308
|
+
|
|
309
|
+
### Added
|
|
310
|
+
- Custom build backend to overcome inability to mark mypy as an optional dependency in the build phase.
|
|
311
|
+
- Support for Python 3.14
|
|
312
|
+
|
|
313
|
+
### Fixed
|
|
314
|
+
- sdist archive contained useless directories.
|
|
315
|
+
- automatically fallback on valid UTF-16 or UTF-32 even if the md says it's noisy. (#633)
|
|
316
|
+
|
|
317
|
+
### Misc
|
|
318
|
+
- SBOM are automatically published to the relevant GitHub release to comply with regulatory changes.
|
|
319
|
+
Each published wheel comes with its SBOM. We choose CycloneDX as the format.
|
|
320
|
+
- Prebuilt optimized wheel are no longer distributed by default for CPython 3.7 due to a change in cibuildwheel.
|
|
321
|
+
|
|
303
322
|
## [3.4.2](https://github.com/Ousret/charset_normalizer/compare/3.4.1...3.4.2) (2025-05-02)
|
|
304
323
|
|
|
305
324
|
### Fixed
|
{charset_normalizer-3.4.2 → charset_normalizer-3.4.3}/src/charset_normalizer.egg-info/SOURCES.txt
RENAMED
|
@@ -13,16 +13,8 @@ dev-requirements.txt
|
|
|
13
13
|
noxfile.py
|
|
14
14
|
pyproject.toml
|
|
15
15
|
setup.py
|
|
16
|
-
.
|
|
17
|
-
|
|
18
|
-
.github/dependabot.yml
|
|
19
|
-
.github/ISSUE_TEMPLATE/bug_report.md
|
|
20
|
-
.github/ISSUE_TEMPLATE/feature_request.md
|
|
21
|
-
.github/ISSUE_TEMPLATE/wrong_charset.md
|
|
22
|
-
.github/workflows/cd.yml
|
|
23
|
-
.github/workflows/ci.yml
|
|
24
|
-
.github/workflows/codeql.yml
|
|
25
|
-
.github/workflows/scorecards.yml
|
|
16
|
+
_mypyc_hook/__init__.py
|
|
17
|
+
_mypyc_hook/backend.py
|
|
26
18
|
bin/bc.py
|
|
27
19
|
bin/coverage.py
|
|
28
20
|
bin/performance.py
|
|
File without changes
|
|
@@ -51,6 +51,30 @@ def test_empty_but_with_bom_or_sig(payload, expected_encoding):
|
|
|
51
51
|
assert str(best_guess) == "", "The cast to str SHOULD be empty"
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
@pytest.mark.parametrize(
|
|
55
|
+
"payload, expected_encoding",
|
|
56
|
+
[
|
|
57
|
+
# https://github.com/jawah/charset_normalizer/issues/633
|
|
58
|
+
# we want to fallback on utf/8/16/32 if md is unhappy
|
|
59
|
+
# with content anyway.
|
|
60
|
+
("▶hello".encode("utf_32"), "utf_32"),
|
|
61
|
+
("▶hello".encode("utf_16"), "utf_16"),
|
|
62
|
+
],
|
|
63
|
+
)
|
|
64
|
+
def test_md_triggered_but_with_bom_or_sig(payload, expected_encoding):
|
|
65
|
+
best_guess = from_bytes(payload).best()
|
|
66
|
+
|
|
67
|
+
assert best_guess is not None, "Detect/fallback with SIG/BOM has failed!"
|
|
68
|
+
assert (
|
|
69
|
+
best_guess.encoding == expected_encoding
|
|
70
|
+
), "Detection SIG/BOM is wrongly detected!"
|
|
71
|
+
assert (
|
|
72
|
+
best_guess.raw == payload
|
|
73
|
+
), "The RAW property should contain the original payload given for detection."
|
|
74
|
+
assert best_guess.byte_order_mark is True, "The BOM/SIG property should return True"
|
|
75
|
+
assert str(best_guess) == "▶hello"
|
|
76
|
+
|
|
77
|
+
|
|
54
78
|
@pytest.mark.parametrize(
|
|
55
79
|
"payload, expected_encoding",
|
|
56
80
|
[
|
|
@@ -41,3 +41,20 @@ class TestDetectLegacy(unittest.TestCase):
|
|
|
41
41
|
|
|
42
42
|
with self.subTest("Verify that UTF-8-SIG is returned when using legacy detect"):
|
|
43
43
|
self.assertEqual(r["encoding"], "UTF-8-SIG")
|
|
44
|
+
|
|
45
|
+
def test_small_payload_confidence_altered(self):
|
|
46
|
+
|
|
47
|
+
with self.subTest("Unicode should yield 1. confidence even on small bytes string"):
|
|
48
|
+
r = detect("#表 10-1 クラスタ設定".encode("utf_16"))
|
|
49
|
+
|
|
50
|
+
self.assertTrue(r["confidence"] == 1.0)
|
|
51
|
+
|
|
52
|
+
with self.subTest("ShiftJis should not yield 1. confidence on small bytes string"):
|
|
53
|
+
r = detect("#表 10-1 クラスタ設定".encode("cp932"))
|
|
54
|
+
|
|
55
|
+
self.assertTrue(r["confidence"] < 1.0)
|
|
56
|
+
|
|
57
|
+
with self.subTest("ShiftJis should yield 1. confidence on sufficient bytes string"):
|
|
58
|
+
r = detect("#表 10-1 クラスタ設定 … リソース同居制約".encode("cp932"))
|
|
59
|
+
|
|
60
|
+
self.assertTrue(r["confidence"] == 1.0)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us fix something bad like an exception
|
|
4
|
-
title: "[BUG]"
|
|
5
|
-
labels: bug, help wanted
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Describe the bug**
|
|
11
|
-
A clear and concise description of what the bug/exception is.
|
|
12
|
-
|
|
13
|
-
**To Reproduce**
|
|
14
|
-
Give us the target text file. Host it somewhere with untouched encoding.
|
|
15
|
-
|
|
16
|
-
**Expected behavior**
|
|
17
|
-
A clear and concise description of what you expected to happen.
|
|
18
|
-
|
|
19
|
-
**Logs**
|
|
20
|
-
If applicable, add console outputs to help explain your problem.
|
|
21
|
-
|
|
22
|
-
**Desktop (please complete the following information):**
|
|
23
|
-
- OS: [e.g. Linux, Windows or Mac]
|
|
24
|
-
- Python version [e.g. 3.5]
|
|
25
|
-
- Package version [eg. 2.0.0]
|
|
26
|
-
|
|
27
|
-
**Additional context**
|
|
28
|
-
Add any other context about the problem here.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Feature request
|
|
3
|
-
about: Suggest an idea for this project
|
|
4
|
-
title: "[Proposal]"
|
|
5
|
-
labels: enhancement
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Is your feature request related to a problem? Please describe.**
|
|
11
|
-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
-
|
|
13
|
-
**Describe the solution you'd like**
|
|
14
|
-
A clear and concise description of what you want to happen.
|
|
15
|
-
|
|
16
|
-
**Describe alternatives you've considered**
|
|
17
|
-
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
-
|
|
19
|
-
**Additional context**
|
|
20
|
-
Add any other context or screenshots about the feature request here.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Wrong charset / Detection issue
|
|
3
|
-
about: Create a report to help us improve the detection mechanism
|
|
4
|
-
title: "[DETECTION]"
|
|
5
|
-
labels: help wanted, detection
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Notice**
|
|
11
|
-
I hereby announce that my raw input is not :
|
|
12
|
-
- Too small content (<=32 characters) as I do know that ANY charset detector heavily depends on content
|
|
13
|
-
- Encoded in a deprecated/abandoned encoding that is not even supported by my interpreter
|
|
14
|
-
|
|
15
|
-
**Provide the file**
|
|
16
|
-
A accessible way of retrieving the file concerned. Host it somewhere with untouched encoding.
|
|
17
|
-
|
|
18
|
-
**Verbose output**
|
|
19
|
-
Using the CLI, run `normalizer -v ./my-file.txt` and past the result in here.
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
(venv) >normalizer -v ./data/sample.1.ar.srt
|
|
23
|
-
2021-05-21 08:38:44,050 | DEBUG | ascii does not fit given bytes sequence at ALL. 'ascii' codec can't decode byte 0xca in position 54: ordinal not in range(128)
|
|
24
|
-
2021-05-21 08:38:44,051 | DEBUG | big5 does not fit given bytes sequence at ALL. 'big5' codec can't decode byte 0xc9 in position 60: illegal multibyte sequence
|
|
25
|
-
2021-05-21 08:38:44,051 | DEBUG | big5hkscs does not fit given bytes sequence at ALL. 'big5hkscs' codec can't decode byte 0xc9 in position 60: illegal multibyte sequence
|
|
26
|
-
....
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Expected encoding**
|
|
30
|
-
A clear and concise description of what you expected as encoding. Any more details about how the current guess is wrong
|
|
31
|
-
is very much appreciated.
|
|
32
|
-
|
|
33
|
-
**Desktop (please complete the following information):**
|
|
34
|
-
- OS: [e.g. Linux, Windows or Mac]
|
|
35
|
-
- Python version [e.g. 3.5]
|
|
36
|
-
- Package version [eg. 2.0.0]
|
|
37
|
-
|
|
38
|
-
**Additional context**
|
|
39
|
-
Add any other context about the problem here.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "pip" # See documentation for possible values
|
|
9
|
-
directory: "/" # Location of package manifests
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "monthly"
|
|
12
|
-
|
|
13
|
-
- package-ecosystem: "github-actions"
|
|
14
|
-
directory: "/"
|
|
15
|
-
schedule:
|
|
16
|
-
interval: "monthly"
|