X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fi18n.php;h=a56f4f426f07e10ea7ce185a8876b85159178b09;hb=2198d485d5b406f3f007f5c0146b275fb8272326;hp=5b33204d07591edfe91aeacebcd1c23f4b327db4;hpb=6c8a387f4a5bf246eac097b8ad38c26e2c997e6e;p=squirrelmail.git diff --git a/functions/i18n.php b/functions/i18n.php index 5b33204d..a56f4f42 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -1,16 +1,16 @@ '),$string); return $string; } } @@ -160,14 +166,13 @@ function charset_decode ($charset, $string, $force_decode=false) { // iconv functions does not have html target and can be used only with utf-8 if ( $use_php_iconv && $default_charset=='utf-8') { $string = iconv($charset,$default_charset,$string); - return htmlspecialchars($string); + return ($save_html ? $string : htmlspecialchars($string)); } // If we don't use recode and iconv, we'll do it old way. /* All HTML special characters are 7 bit and can be replaced first */ - - $string = htmlspecialchars ($string); + if (! $save_html) $string = htmlspecialchars ($string); /* controls cpu and memory intensive decoding cycles */ if (! isset($aggressive_decoding) || $aggressive_decoding=="" ) { @@ -177,7 +182,8 @@ function charset_decode ($charset, $string, $force_decode=false) { $decodefile=SM_PATH . 'functions/decode/' . $decode . '.php'; if (file_exists($decodefile)) { include_once($decodefile); - $ret = call_user_func('charset_decode_'.$decode, $string); + // send $save_html argument to decoding function. needed for iso-2022-xx decoding. + $ret = call_user_func('charset_decode_'.$decode, $string, $save_html); } else { $ret = $string; } @@ -255,6 +261,13 @@ function fixcharset($charset) { */ $charset=preg_replace("/[-:.\/\\\]/",'_',$charset); + // OE ks_c_5601_1987 > cp949 + $charset=str_replace('ks_c_5601_1987','cp949',$charset); + // Moz x-euc-tw > euc-tw + $charset=str_replace('x_euc','euc',$charset); + // Moz x-windows-949 > cp949 + $charset=str_replace('x_windows_','cp',$charset); + // windows-125x and cp125x charsets $charset=str_replace('windows_','cp',$charset); @@ -402,8 +415,13 @@ function set_up_language($sm_language, $do_search = false, $default = false) { // Many functions expect English conversion rules. if ($sm_notAlias=='tr_TR') setlocale(LC_CTYPE,'C'); - // Set text direction/alignment variables - // These don't appear to be used... are they safe to remove? + /** + * Set text direction/alignment variables + * When language environment is setup, scripts can use these globals + * without accessing $languages directly and making checks for optional + * array key. + */ + global $text_direction, $left_align, $right_align; if (isset($languages[$sm_notAlias]['DIR']) && $languages[$sm_notAlias]['DIR'] == 'rtl') { /**