Masato's Fix
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 6 Sep 2002 15:56:12 +0000 (15:56 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 6 Sep 2002 15:56:12 +0000 (15:56 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3594 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/i18n.php

index 92deb52..107f2cf 100644 (file)
@@ -1090,7 +1090,33 @@ function japanese_charset_xtra() {
             $ret = mb_strimwidth($ret, 0, $width, '...'); 
             break;
         case 'encodeheader':
-            $ret = mb_encode_mimeheader($ret);
+            $result = '';
+            if (strlen($ret) > 0) {
+                $tmpstr = mb_substr($ret, 0, 1);
+                $prevcsize = strlen($tmpstr);
+                for ($i = 1; $i < mb_strlen($ret); $i++) {
+                    $tmp = mb_substr($ret, $i, 1);
+                    if (strlen($tmp) == $prevcsize) {
+                        $tmpstr .= $tmp;
+                    } else {
+                        if ($prevcsize == 1) {
+                            $result .= $tmpstr;
+                        } else {
+                            $result .= mb_encode_mimeheader($tmpstr);
+                        }
+                        $tmpstr = $tmp;
+                        $prevcsize = strlen($tmp);
+                    }
+                }
+                if (strlen($tmpstr)) {
+                    if (strlen(mb_substr($tmpstr, 0, 1)) == 1)
+                        $result .= $tmpstr;
+                    else
+                        $result .= mb_encode_mimeheader($tmpstr);
+                }
+            }
+            $ret = $result;
+            //$ret = mb_encode_mimeheader($ret);
             break;
         case 'decodeheader':
             $ret = str_replace("\t", "", $ret);