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:
Karim shoair
2025-09-23 18:32:56 +03:00
parent 38e7941b71
commit 63a46a8e0b
+2 -2
View File
@@ -341,7 +341,7 @@ class Selector(SelectorsGeneration):
"""Return the inner HTML code of the element"""
content = tostring(self._root, encoding=self.encoding, method="html", with_tail=False)
if isinstance(content, bytes):
content = content.decode("utf-8")
content = content.strip().decode(self.encoding)
return TextHandler(content)
@property
@@ -359,7 +359,7 @@ class Selector(SelectorsGeneration):
with_tail=False,
)
if isinstance(content, bytes):
content = content.decode("utf-8")
content = content.strip().decode(self.encoding)
return TextHandler(content)
def has_class(self, class_name: str) -> bool: