Skip to content

Commit

Permalink
#545 trim comma from encoding value
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Popov committed Nov 7, 2024
1 parent c6eecb7 commit aa2829e
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 aa2829e

Please sign in to comment.