Karim shoair commited on
Commit ·
58ce87c
1
Parent(s): 0136fff
fix(parser): Better approach for web pages where the encoding is not always correctly declared
Browse files- scrapling/parser.py +1 -1
scrapling/parser.py
CHANGED
|
@@ -121,7 +121,7 @@ class Selector(SelectorsGeneration):
|
|
| 121 |
self.__text = None
|
| 122 |
if root is None:
|
| 123 |
if isinstance(content, str):
|
| 124 |
-
body = content.strip().replace("\x00", "")
|
| 125 |
elif isinstance(content, bytes):
|
| 126 |
body = content.replace(b"\x00", b"")
|
| 127 |
else:
|
|
|
|
| 121 |
self.__text = None
|
| 122 |
if root is None:
|
| 123 |
if isinstance(content, str):
|
| 124 |
+
body = content.strip().replace("\x00", "") or "<html/>"
|
| 125 |
elif isinstance(content, bytes):
|
| 126 |
body = content.replace(b"\x00", b"")
|
| 127 |
else:
|