浏览代码

Call set_my_charset() before actually using , and fix variable name in case != iso-8859-1, all pointed out by Tomas ;)

alex-brainstorm 22 年之前
父节点
当前提交
e315732f7f
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      functions/imap_utf7_local.php

+ 3 - 2
functions/imap_utf7_local.php

@@ -20,8 +20,7 @@ function sqimap_mb_convert_encoding($str, $to_encoding, $from_encoding, $default
        stristr('utf-8',$default_charset) || 
        stristr('utf-8',$default_charset) || 
        stristr('iso-2022-jp',$default_charset) ) {
        stristr('iso-2022-jp',$default_charset) ) {
     if (function_exists('mb_convert_encoding')) {
     if (function_exists('mb_convert_encoding')) {
-      set_my_charset();
-      return mb_convert_encoding($s, $to_encoding, $from_encoding);
+      return mb_convert_encoding($str, $to_encoding, $from_encoding);
     }
     }
   }
   }
   return '';
   return '';
@@ -39,6 +38,7 @@ function imap_utf7_encode_local($s) {
       return '';
       return '';
 
 
     global $default_charset;
     global $default_charset;
+    set_my_charset();
     if (strtolower($default_charset) != 'iso-8859-1') {
     if (strtolower($default_charset) != 'iso-8859-1') {
       $utf7_s = sqimap_mb_convert_encoding($s, 'UTF7-IMAP', $default_charset, $default_charset);
       $utf7_s = sqimap_mb_convert_encoding($s, 'UTF7-IMAP', $default_charset, $default_charset);
       if ($utf7_s != '')
       if ($utf7_s != '')
@@ -91,6 +91,7 @@ function imap_utf7_decode_local($s) {
       return '';
       return '';
 
 
     global $default_charset;
     global $default_charset;
+    set_my_charset();
     if (strtolower($default_charset) != 'iso-8859-1') {
     if (strtolower($default_charset) != 'iso-8859-1') {
       $utf7_s = sqimap_mb_convert_encoding($s, $default_charset, 'UTF7-IMAP', $default_charset);
       $utf7_s = sqimap_mb_convert_encoding($s, $default_charset, 'UTF7-IMAP', $default_charset);
       if ($utf7_s != '')
       if ($utf7_s != '')