From c6eecb74e6de5cbb500889258830cefba9c22bf5 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 7 Nov 2024 14:20:31 +0200 Subject: [PATCH] trim comma from encoding value --- src/Document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Document.php b/src/Document.php index 0d342c75..12cc9721 100644 --- a/src/Document.php +++ b/src/Document.php @@ -34,7 +34,7 @@ public function __construct(Extractor $extractor) } elseif (!empty($html)) { preg_match('/charset="?(.*?)(?=$|\s|;|")/i', $html, $match); if (!empty($match[1])) { - $encoding = $match[1]; + $encoding = trim($match[1], ','); } } $this->document = !empty($html) ? Parser::parse($html, $encoding) : new DOMDocument();