From aa2829ead04d37659ab2ed58f0082f5b09ee9b9a Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 7 Nov 2024 15:08:01 +0200 Subject: [PATCH] #545 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 12cc9721..6db07663 100644 --- a/src/Document.php +++ b/src/Document.php @@ -30,7 +30,7 @@ public function __construct(Extractor $extractor) $contentType = $extractor->getResponse()->getHeaderLine('content-type'); preg_match('/charset="?(.*?)(?=$|\s|;|")/i', $contentType, $match); if (!empty($match[1])) { - $encoding = $match[1]; + $encoding = trim($match[1], ','); } elseif (!empty($html)) { preg_match('/charset="?(.*?)(?=$|\s|;|")/i', $html, $match); if (!empty($match[1])) {