Skip to content

Commit a8524b4

Browse files
authored
Merge pull request #313 from jtojnar/backports
Backport recent fixes
2 parents a7c0b58 + c8c78a0 commit a8524b4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Extractor/ContentExtractor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public function reset()
8888
$this->siteConfig = null;
8989
$this->title = null;
9090
$this->body = null;
91+
$this->image = null;
9192
$this->nativeAd = false;
9293
$this->date = null;
9394
$this->language = null;

src/Graby.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,11 @@ private function convert2Utf8($html, array $headers = [])
957957
$html_head = substr($html, 0, 50000);
958958
if (preg_match('/^<\?xml\s+version=(?:"[^"]*"|\'[^\']*\')\s+encoding=("[^"]*"|\'[^\']*\')/s', $html_head, $match)) {
959959
$encoding = trim($match[1], '"\'');
960-
} elseif (preg_match('/<meta\s+http-equiv=["\']?Content-Type["\']? content=["\'][^;]+;\s*charset=["\']?([^;"\'>]+)/i', $html_head, $match)) {
960+
} elseif (preg_match('/<meta\s+http-equiv\s*=\s*["\']?Content-Type["\']? content\s*=\s*["\'][^;]+;\s*charset=["\']?([^;"\'>]+)/i', $html_head, $match)) {
961961
$encoding = trim($match[1]);
962962
} elseif (preg_match_all('/<meta\s+([^>]+)>/i', $html_head, $match)) {
963963
foreach ($match[1] as $_test) {
964-
if (preg_match('/charset=["\']?([^"\']+)/i', $_test, $_m)) {
964+
if (preg_match('/charset\s*=\s*["\']?([^"\']+)/i', $_test, $_m)) {
965965
$encoding = trim($_m[1]);
966966
break;
967967
}

0 commit comments

Comments
 (0)