From 170205599d45eb1407c9c1a450fc9274d0e88838 Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Sat, 22 Nov 2025 20:24:55 +0200 Subject: [PATCH] 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 --- scrapling/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrapling/parser.py b/scrapling/parser.py index ac97b7d..95b88ee 100644 --- a/scrapling/parser.py +++ b/scrapling/parser.py @@ -121,7 +121,7 @@ class Selector(SelectorsGeneration): self.__text = None if root is None: if isinstance(content, str): - body = content.strip().replace("\x00", "").encode(encoding) or b"" + body = content.strip().replace("\x00", "") or "" elif isinstance(content, bytes): body = content.replace(b"\x00", b"") else: