browse/utils: Reinstate chardet use but only as a fallback
While charset_normalizer performs usually better than chardet, it remains some edge cases where it can fail to detect content encoding while chardet succeeds. So try to detect content encoding with chardet as a fallback when charset_normalizer failed.
Showing
- .pre-commit-config.yaml 2 additions, 1 deletion.pre-commit-config.yaml
- requirements.txt 1 addition, 0 deletionsrequirements.txt
- swh/web/browse/tests/data/content_iso-8859-7_encoded 815 additions, 0 deletionsswh/web/browse/tests/data/content_iso-8859-7_encoded
- swh/web/browse/tests/test_utils.py 9 additions, 0 deletionsswh/web/browse/tests/test_utils.py
- swh/web/browse/utils.py 5 additions, 0 deletionsswh/web/browse/utils.py
... | ... | @@ -2,6 +2,7 @@ |
# should match https://pypi.python.org/pypi names. For the full spec or | ||
# dependency lines, see https://pip.readthedocs.org/en/1.1/requirements.html | ||
chardet | ||
charset-normalizer | ||
cryptography | ||
django | ||
... | ... |
This diff is collapsed.
Please register or sign in to comment