Skip to content

Commit 72589d2

Browse files
authored
Merge pull request #46 from wadjei/issue-45-charset-detection-bugfix-proposal
2 parents edf3723 + 19f3521 commit 72589d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Document.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function getEncoding(): ?string {
190190
private function getCharset(string $html): ?string {
191191
$charset = null;
192192

193-
if (preg_match('@<meta.*?charset=["\']?([^"\'\s>]+)@im', $html, $matches)) {
193+
if (preg_match('@<meta[^>]*?charset=["\']?([^"\'\s>]+)@im', $html, $matches)) {
194194
$charset = mb_strtoupper($matches[1]);
195195
}
196196

0 commit comments

Comments
 (0)