Skip to content

Commit

Permalink
mb_convert_encoding does not support windows-1250. #1037
Browse files Browse the repository at this point in the history
Signed-off-by: Astinus Eberhard <astinus.eberhard@gmail.com>
  • Loading branch information
Astinus-Eberhard committed Apr 3, 2023
1 parent c2fa1ff commit a47ca70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Model/IMAPMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,11 @@ private function loadBodyData(Horde_Mime_Part $p, $partNo): string {
// data is utf-8 by default.
$charset = $p->getContentTypeParameter('charset');
if ($charset !== null && strtoupper($charset) !== 'UTF-8') {
$data = mb_convert_encoding($data, 'UTF-8', $charset);
try {
$data = mb_convert_encoding($data, 'UTF-8', $charset);
} catch (\Throwable $ex) {
$data = iconv($charset, 'UTF-8//TRANSLIT', $data);
}
}
return (string)$data;
}
Expand Down

0 comments on commit a47ca70

Please sign in to comment.