diff options
| author | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-02-08 17:33:08 +0000 |
|---|---|---|
| committer | thomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-02-08 17:33:08 +0000 |
| commit | e38c65674366f904b2b96080397e72380f2e71c4 (patch) | |
| tree | 1060d4be1784440f107b9df11dad64547cddadf7 /roundcubemail/program/include | |
| parent | f5f293ee602c7e2aa7594a6984577b9ac2f8d040 (diff) | |
Added some charset aliases to fix typical mis-labelling (#1484565)
git-svn-id: https://svn.roundcube.net/trunk@1032 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
| -rw-r--r-- | roundcubemail/program/include/main.inc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 61a9c9cd1..9e33bae69 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/program/include/main.inc @@ -907,18 +907,26 @@ function rcube_charset_convert($str, $from, $to=NULL) if ($from==$to || $str=='' || empty($from)) return $str; + + $aliases = array( + 'UNKNOWN-8BIT' => 'ISO-8859-15', + 'X-UNKNOWN' => 'ISO-8859-15', + 'X-USER-DEFINED' => 'ISO-8859-15', + 'ISO-8859-8-I' => 'ISO-8859-8', + 'KS_C_5601-1987' => 'EUC-KR', + 'GB2312' => 'GB18030' + ); // convert charset using iconv module if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { - $iconv_map = array('KS_C_5601-1987' => 'EUC-KR'); - return iconv(($iconv_map[$from] ? $iconv_map[$from] : $from), ($iconv_map[$to] ? $iconv_map[$to] : $to) . "//IGNORE", $str); + return iconv(($aliases[$from] ? $aliases[$from] : $from), ($aliases[$to] ? $aliases[$to] : $to) . "//IGNORE", $str); } // convert charset using mbstring module if ($MBSTRING) { - $mb_map = array('UTF-7' => 'UTF7-IMAP', 'KS_C_5601-1987' => 'EUC-KR'); + $mb_map = $aliases + array('UTF-7' => 'UTF7-IMAP'); // return if convert succeeded if (($out = mb_convert_encoding($str, ($mb_map[$to] ? $mb_map[$to] : $to), ($mb_map[$from] ? $mb_map[$from] : $from))) != '') |
