summaryrefslogtreecommitdiff
path: root/bs4/dammit.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2015-06-25 07:04:00 -0400
committerLeonard Richardson <leonardr@segfault.org>2015-06-25 07:04:00 -0400
commitfee5d1d8f62254939939eb97ac56d7c4f158e6cf (patch)
treeda3fe37e5b5cf93c871ce1b2ec60cc7bfc2448a4 /bs4/dammit.py
parentbc85e533729738de1100fabe23ddc71b41933a7a (diff)
Fixed a crash in Unicode, Dammit's encoding detector when the name
of the encoding itself contained invalid bytes. [bug=1360913]
Diffstat (limited to 'bs4/dammit.py')
-rw-r--r--bs4/dammit.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bs4/dammit.py b/bs4/dammit.py
index 59640b7..68ed81f 100644
--- a/bs4/dammit.py
+++ b/bs4/dammit.py
@@ -306,7 +306,7 @@ class EncodingDetector:
declared_encoding_match = html_meta_re.search(markup, endpos=html_endpos)
if declared_encoding_match is not None:
declared_encoding = declared_encoding_match.groups()[0].decode(
- 'ascii')
+ 'ascii', 'replace')
if declared_encoding:
return declared_encoding.lower()
return None