8000 Merge pull request #124 from dariobig/patch-1 · Harry0201/python-readability@615ce80 · GitHub
[go: up one dir, main page]

Skip to content

Commit 615ce80

Browse files
authored
Merge pull request buriy#124 from dariobig/patch-1
Catch LookupError in case of bad encoding string
2 parents 52f767c + 0442358 commit 615ce80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

readability/encoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def get_encoding(page):
4646
page.decode(encoding)
4747
# It worked!
4848
return encoding
49-
except UnicodeDecodeError:
49+
except (UnicodeDecodeError, LookupError):
5050
pass
5151

5252
# Fallback to chardet if declared encodings fail

0 commit comments

Comments
 (0)
0