Skip to content

Commit

Permalink
Merge pull request #1992 from sokai/patch-1
Browse files Browse the repository at this point in the history
Fix description retrieval when page charset is not UTF-8
  • Loading branch information
nodiscc authored Mar 1, 2024
2 parents 0a418b9 + 661419b commit 7909448
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions application/http/MetadataRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public function retrieve(string $url): array
if (!empty($title) && strtolower($charset) !== 'utf-8') {
$title = mb_convert_encoding($title, 'utf-8', $charset);
}
if (!empty($description) && strtolower($charset) !== 'utf-8') {
$description = mb_convert_encoding($description, 'utf-8', $charset);
}
if (!empty($tags) && strtolower($charset) !== 'utf-8') {
$tags = mb_convert_encoding($tags, 'utf-8', $charset);
}

return array_map([$this, 'cleanMetadata'], [
'title' => $title,
Expand Down

0 comments on commit 7909448

Please sign in to comment.