Skip to content

Commit 1203172

Browse files
committed
Switch to chardet for stable behavior
charset_normalizer has stability issues Reference: jawah/charset_normalizer#520 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 9127939 commit 1203172

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
attrs==22.2.0
22
beautifulsoup4==4.11.2
33
certifi==2022.12.7
4-
charset-normalizer==3.0.1
4+
chardet==5.2.0
55
click==8.1.3
66
idna==3.4
77
pip==23.0

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ python_requires = >=3.8
4141

4242
install_requires =
4343
attrs >= 18.1, !=20.1.0
44-
Beautifulsoup4 >= 4.0.0
44+
Beautifulsoup4[chardet] >= 4.0.0
4545
click >= 6.7, !=7.0
46-
requests >= 2.7.0
46+
requests[use_chardet_on_py3] >= 2.7.0
4747
saneyaml >= 0.5.2
4848
text_unidecode >= 1.0
4949

tests/test_paths.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ def test_safe_path_posix_style_french_char(self):
7676

7777
def test_safe_path_posix_style_chinese_char(self):
7878
test = paths.safe_path(b'/includes/webform.compon\xd2\xaants.inc/')
79-
expected = 'includes/webform.componNSnts.inc'
80-
assert test == expected
79+
expected = [
80+
'includes/webform.componNSnts.inc',
81+
'includes/webform.componS_nts.inc',
82+
]
83+
assert test in expected
8184

8285
def test_safe_path_windows_style_dots(self):
8386
test = paths.safe_path('\\includes\\..\\webform.components.inc\\')

0 commit comments

Comments
 (0)