Changeset 5706
- Timestamp:
- 04/10/08 14:20:22 (9 months ago)
- Location:
- branches/1.6/components
- Files:
-
- 2 modified
-
Eolin.PHP.Core.php (modified) (1 diff)
-
Eolin.PHP.UnifiedEnvironment.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.6/components/Eolin.PHP.Core.php
r5637 r5706 110 110 } 111 111 } 112 if (preg_match('/&#([0-9]{1,});/', $corrected)) 113 $corrected = mb_decode_numericentity($corrected, array(0x0, 0x10000, 0, 0xfffff), 'UTF-8'); 112 114 return $corrected; 113 115 } -
branches/1.6/components/Eolin.PHP.UnifiedEnvironment.php
r5637 r5706 44 44 $_SERVER['REMOTE_ADDR'] = $firstIP[0]; 45 45 } 46 46 /* Workaround for iconv-absent environment. (contributed by Papacha) */ 47 47 if (!function_exists('iconv')) { 48 48 if (function_exists('mb_convert_encoding')) { … … 54 54 } 55 55 } 56 /* Workaround for NCR treatment. (contributed by Laziel) */ 57 if (!function_exists('mb_decode_numericentity')) { 58 function mb_decode_numericentity($str, $dumb = null, $dumber = null) { 59 if (!function_exists('_mb_decode_numericentity_callback') ) { 60 function _mb_decode_numericentity_callback($t) { 61 $decode = $t[1]; 62 if ($decode < 128) { 63 $str = chr($decode); 64 } else if ($decode < 2048) { 65 $str = chr(192 + (($decode - ($decode % 64)) / 64)); 66 $str .= chr(128 + ($decode % 64)); 67 } else { 68 $str = chr(224 + (($decode - ($decode % 4096)) / 4096)); 69 $str .= chr(128 + ((($decode % 4096) - ($decode % 64)) / 64)); 70 $str .= chr(128 + ($decode % 64)); 71 } 72 return $str; 73 } 74 } 75 return preg_replace_callback('/&#([0-9]{1,});/', '_mb_decode_numericentity_callback', $str); 76 } 77 } 56 78 ?>
