Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric Kastner committed Sep 5, 2018
1 parent e90abcc commit c256182
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Fetch/MIME.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public static function decode($text, $targetCharset = 'utf-8')

foreach (imap_mime_header_decode($text) as $word) {
$ch = 'default' === $word->charset ? 'ascii' : $word->charset;

if ($ch === "ascii" && ($c = strtoupper(mb_detect_encoding($word->text))) !== strtoupper($ch)) {
$ch=$c;
}
$result .= iconv($ch, $targetCharset, $word->text);
}

Expand Down

0 comments on commit c256182

Please sign in to comment.