Changeset 374 for minimanager/js/ajax/Php.php
- Timestamp:
- Sep 11, 2008, 9:10:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
minimanager/js/ajax/Php.php
r5 r374 20 20 class JsHttpRequest 21 21 { 22 var $SCRIPT_ENCODING = " windows-1251";22 var $SCRIPT_ENCODING = "utf-8"; 23 23 var $SCRIPT_DECODE_MODE = ''; 24 24 var $UNIQ_HASH; … … 277 277 /** 278 278 * Convert from UCS-2BE decimal to $toEnc. 279 */ 279 */ 280 280 function _decUcs2Decode($code, $toEnc) 281 281 { 282 // Little speedup by using array_flip($this->_encTables) and later hash access. 283 static $flippedTable = null; 282 284 if ($code < 128) return chr($code); 285 283 286 if (isset($this->_encTables[$toEnc])) { 284 $p = array_search($code, $this->_encTables[$toEnc]); 285 if ($p !== false) return chr(128 + $p); 286 } 287 if (!$flippedTable) $flippedTable = array_flip($this->_encTables[$toEnc]); 288 if (isset($flippedTable[$code])) return chr(128 + $flippedTable[$code]); 289 } else if ($toEnc == 'utf-8' || $toEnc == 'utf8') { 290 // UTF-8 conversion rules: http://www.cl.cam.ac.uk/~mgk25/unicode.html 291 if ($code < 0x800) { 292 return chr(0xC0 + ($code >> 6)) . 293 chr(0x80 + ($code & 0x3F)); 294 } else { // if ($code <= 0xFFFF) -- it is almost always so for UCS2-BE 295 return chr(0xE0 + ($code >> 12)) . 296 chr(0x80 + (0x3F & ($code >> 6))) . 297 chr(0x80 + ($code & 0x3F)); 298 } 299 } 300 287 301 return ""; 288 302 }
Note:
See TracChangeset
for help on using the changeset viewer.