From 55d6c7ca00565f9b70e13975837bcfa70aff6c03 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 11 May 2010 15:38:39 +0000 Subject: [PATCH] "prefer iconv for windows-874 and tis-620 (Thai) charsets, as they are not supported by mbstring" --- phpgwapi/inc/class.translation.inc.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php index 33d6b81f28..7235416761 100644 --- a/phpgwapi/inc/class.translation.inc.php +++ b/phpgwapi/inc/class.translation.inc.php @@ -535,6 +535,10 @@ class translation case 'windows-1257': $from = 'iso-8859-13'; break; + case 'windows-874': + case 'tis-620': + $prefer_iconv = true; + break; } if (!$to) { @@ -561,7 +565,7 @@ class translation { return utf8_decode($data); } - if (self::$mbstring && ($data = @mb_convert_encoding($data,$to,$from)) != '') + if (self::$mbstring && !$prefer_iconv && ($data = @mb_convert_encoding($data,$to,$from)) != '') { return $data; } @@ -589,7 +593,7 @@ class translation // in an email on the first Traditional/Japanese/Korean character, // but in reality when people send mails in GB2312, UMA mostly use // extended GB13000/GB18030 which allow T/Jap/Korean characters. - if($from == 'EUC-CN') + if($from == 'euc-cn') { $from = 'gb18030'; } @@ -1055,7 +1059,7 @@ class translation * @param string $tag is the tagname which is to be removed. Note, that only the name of the tag is to be passed to the function * without the enclosing brackets * @param string $endtag can be different from tag but should be used only, if begin and endtag are known to be different e.g.: - * @param bool $addbbracesforendtag if endtag is given, you may decide if the braces are to be added, + * @param bool $addbbracesforendtag if endtag is given, you may decide if the braces are to be added, * or if you want the string to be matched as is * @return void the modified text is passed via reference */