We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1da3d4 commit 32e386fCopy full SHA for 32e386f
src/Document.php
@@ -28,11 +28,11 @@ public function __construct(Extractor $extractor)
28
29
$encoding = null;
30
$contentType = $extractor->getResponse()->getHeaderLine('content-type');
31
- preg_match('/charset="?(.*?)(?=$|\s|;|")/i', $contentType, $match);
+ preg_match('/charset=(?:"|\')?(.*?)(?=$|\s|;|"|\'|>)/i', $contentType, $match);
32
if (!empty($match[1])) {
33
$encoding = trim($match[1], ',');
34
} elseif (!empty($html)) {
35
- preg_match('/charset="?(.*?)(?=$|\s|;|")/i', $html, $match);
+ preg_match('/charset=(?:"|\')?(.*?)(?=$|\s|;|"|\'|>)/i', $html, $match);
36
37
38
}
0 commit comments