Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ Patches and suggestions
- Ville Skyttä
- Hugo van Kemenade
- Mark Vasilkov
- Afonso Januário

3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Bug fixes:

* The sanitizer now permits ``<summary>`` tags. It used to allow ``<details>``
already. (#423)
* Encoding detection no longer triggers a ``DeprecationWarning`` under
chardet 7+, which moved ``UniversalDetector`` out of
``chardet.universaldetector``. (#601)

1.1
~~~
Expand Down
12 changes: 9 additions & 3 deletions html5lib/_inputstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,16 @@ def determineEncoding(self, chardet=True):
# Guess with chardet, if available
if chardet:
try:
from chardet.universaldetector import UniversalDetector
# chardet 7+ moved UniversalDetector here; the older
# chardet.universaldetector path still works but now raises
# a DeprecationWarning.
from chardet.detector import UniversalDetector
except ImportError:
pass
else:
try:
from chardet.universaldetector import UniversalDetector
except ImportError:
UniversalDetector = None
if UniversalDetector is not None:
buffers = []
detector = UniversalDetector()
while not detector.done:
Expand Down