fix(parser): Better approach for web pages where the encoding is not always correctly declared
Fixes #110 and avoids defaulting to a specific encoding like #111
This commit is contained in:
+1
-1
@@ -121,7 +121,7 @@ class Selector(SelectorsGeneration):
|
|||||||
self.__text = None
|
self.__text = None
|
||||||
if root is None:
|
if root is None:
|
||||||
if isinstance(content, str):
|
if isinstance(content, str):
|
||||||
body = content.strip().replace("\x00", "").encode(encoding) or b"<html/>"
|
body = content.strip().replace("\x00", "") or "<html/>"
|
||||||
elif isinstance(content, bytes):
|
elif isinstance(content, bytes):
|
||||||
body = content.replace(b"\x00", b"")
|
body = content.replace(b"\x00", b"")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user