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();