fix(parser): An encoding issue with converting bytes to string on some encoding types
Removing that `invalid start byte` annoying bug
This commit is contained in:
+2
-2
@@ -341,7 +341,7 @@ class Selector(SelectorsGeneration):
|
|||||||
"""Return the inner HTML code of the element"""
|
"""Return the inner HTML code of the element"""
|
||||||
content = tostring(self._root, encoding=self.encoding, method="html", with_tail=False)
|
content = tostring(self._root, encoding=self.encoding, method="html", with_tail=False)
|
||||||
if isinstance(content, bytes):
|
if isinstance(content, bytes):
|
||||||
content = content.decode("utf-8")
|
content = content.strip().decode(self.encoding)
|
||||||
return TextHandler(content)
|
return TextHandler(content)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -359,7 +359,7 @@ class Selector(SelectorsGeneration):
|
|||||||
with_tail=False,
|
with_tail=False,
|
||||||
)
|
)
|
||||||
if isinstance(content, bytes):
|
if isinstance(content, bytes):
|
||||||
content = content.decode("utf-8")
|
content = content.strip().decode(self.encoding)
|
||||||
return TextHandler(content)
|
return TextHandler(content)
|
||||||
|
|
||||||
def has_class(self, class_name: str) -> bool:
|
def has_class(self, class_name: str) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user