Skip to content

Commit

Permalink
Merge pull request #547 from valentin-popov/master
Browse files Browse the repository at this point in the history
#545 trim comma from encoding value
  • Loading branch information
oscarotero authored Nov 7, 2024
2 parents 137d9a9 + aa2829e commit ec7a635
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down

0 comments on commit ec7a635

Please sign in to comment.