| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * @package i18n 12 * @version $Id: utf8.inc.php 5969 2007-06-08 10:51:09Z pachanga $ 13 */ 14 lmb_require('limb/i18n/src/charset/lmbUTF8BaseDriver.class.php'); 15 lmb_require('limb/i18n/src/charset/lmbUTF8MbstringDriver.class.php'); 16 lmb_require('limb/i18n/src/charset/driver.inc.php'); 17 18 if(!defined('LIMB_UTF8_IGNORE_MBSTRING') && function_exists('mb_strlen')) 19 { 20 lmb_require('limb/i18n/src/charset/lmbUTF8MbstringDriver.class.php'); 21 lmb_use_charset_driver(new lmbUTF8MbstringDriver()); 22 } 23 else 24 { 25 lmb_require('limb/i18n/src/charset/lmbUTF8BaseDriver.class.php'); 26 lmb_use_charset_driver(new lmbUTF8BaseDriver()); 27 } 28 29 function lmb_utf8_to_win1251($str) 30 { 31 static $conv = ''; 32 if(!is_array($conv)) 33 { 34 $conv = array(); 35 for($x = 128; $x <= 143; $x++) 36 { 37 $conv['utf'][] = chr(209) . chr($x); 38 $conv['win'][] = chr($x + 112); 39 } 40 41 for($x = 144; $x <= 191; $x++) 42 { 43 $conv['utf'][] = chr(208) . chr($x); 44 $conv['win'][] = chr($x + 48); 45 } 46 47 $conv['utf'][] = chr(208) . chr(129); 48 $conv['win'][] = chr(168); 49 $conv['utf'][] = chr(209) . chr(145); 50 $conv['win'][] = chr(184); 51 } 52 53 return str_replace($conv['utf'], $conv['win'], $str); 54 } 55 56 function lmb_win1251_to_utf8($s) 57 { 58 $c209 = chr(209); 59 $c208 = chr(208); 60 $c129 = chr(129); 61 $t = ''; 62 for($i = 0; $i < strlen($s); $i++) 63 { 64 $c = ord($s[$i]); 65 if($c >= 192 && $c <= 239) 66 $t .= $c208 . chr($c-48); 67 elseif($c > 239) 68 $t .= $c209 . chr($c-112); 69 elseif($c == 184) 70 $t .= $c209 . $c209; 71 elseif($c == 168) 72 $t .= $c208 . $c129; 73 else 74 $t .= $s[$i]; 75 } 76 return $t; 77 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Aug 28 04:51:15 2008 | Cross-referenced by PHPXref 0.7 |