Skip to content

Commit

Permalink
Replace invalid utf-8 characters by visually equivilant characters
Browse files Browse the repository at this point in the history
  • Loading branch information
siebsie23 committed Apr 10, 2024
1 parent ac92b09 commit 6b89905
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/InboundEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public static function fromMessage($message)
$encoding = mb_detect_encoding($message, ['UTF-8', 'ISO-8859-1', 'windows-1252', 'KOI8-R', 'BIG5', 'GB2312', 'Shift_JIS']);
$static_message = ($encoding !== 'UTF-8') ? mb_convert_encoding($message, 'UTF-8', $encoding) : $message;

// Replace invalid utf-8 characters by visually similar characters
$static_message = iconv('UTF-8', 'UTF-8//TRANSLIT', $static_message);

return new static([
'message' => $static_message,
]);
Expand Down

0 comments on commit 6b89905

Please sign in to comment.