Changeset 324 in subversion for trunk/roundcubemail/program/include/main.inc
- Timestamp:
- Aug 23, 2006 5:52:13 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/include/main.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/main.inc
r321 r324 378 378 function rcmail_set_locale($lang) 379 379 { 380 global $OUTPUT, $MBSTRING , $MBSTRING_ENCODING;380 global $OUTPUT, $MBSTRING; 381 381 static $s_mbstring_loaded = NULL; 382 382 383 383 // settings for mbstring module (by Tadashi Jokagi) 384 if ($s_mbstring_loaded===NULL) 385 { 386 if ($s_mbstring_loaded = extension_loaded("mbstring")) 387 { 388 $MBSTRING = TRUE; 389 if (function_exists("mb_mbstring_encodings")) 390 $MBSTRING_ENCODING = mb_mbstring_encodings(); 391 else 392 $MBSTRING_ENCODING = array("ISO-8859-1", "UTF-7", "UTF7-IMAP", "UTF-8", 393 "ISO-2022-JP", "EUC-JP", "EUCJP-WIN", 394 "SJIS", "SJIS-WIN"); 395 396 $MBSTRING_ENCODING = array_map("strtoupper", $MBSTRING_ENCODING); 397 if (in_array("SJIS", $MBSTRING_ENCODING)) 398 $MBSTRING_ENCODING[] = "SHIFT_JIS"; 399 } 400 else 401 { 402 $MBSTRING = FALSE; 403 $MBSTRING_ENCODING = array(); 404 } 405 } 406 407 if ($MBSTRING && function_exists("mb_language")) 408 { 409 if (!@mb_language(strtok($lang, "_"))) 410 $MBSTRING = FALSE; // unsupport language 411 } 384 if (is_null($s_mbstring_loaded)) 385 $MBSTRING = $s_mbstring_loaded = extension_loaded("mbstring"); 386 else 387 $MBSTRING = $s_mbstring_loaded = FALSE; 412 388 413 389 $OUTPUT->set_charset(rcube_language_prop($lang, 'charset')); … … 869 845 function rcube_charset_convert($str, $from, $to=NULL) 870 846 { 871 global $MBSTRING , $MBSTRING_ENCODING;847 global $MBSTRING; 872 848 873 849 $from = strtoupper($from); 874 850 $to = $to==NULL ? strtoupper($GLOBALS['CHARSET']) : strtoupper($to); 875 851 876 if ($from==$to )852 if ($from==$to || $str=='') 877 853 return $str; 878 854 879 855 // convert charset using mbstring module 880 856 if ($MBSTRING) … … 882 858 $to = $to=="UTF-7" ? "UTF7-IMAP" : $to; 883 859 $from = $from=="UTF-7" ? "UTF7-IMAP": $from; 884 885 if (in_array($to, $MBSTRING_ENCODING) && in_array($from, $MBSTRING_ENCODING)) 886 return mb_convert_encoding($str, $to, $from); 860 861 // return if convert succeeded 862 if (($out = mb_convert_encoding($str, $to, $from)) != '') 863 return $out; 887 864 } 888 865
Note: See TracChangeset
for help on using the changeset viewer.
