note 31791 modified in function.convert-cyr-string by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 14:55:18 +0000 |
| Subject: | note 31791 modified in function.convert-cyr-string by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79905@lists.php.net to get a copy of this message | ||
previous bit of code (grmaxim's win_to_utf8 function) didn't work for me, so I wrote my
own func to convert from win1251 to utf8:
<?php
function win2utf($s) {
for($i=0,$m=strlen($s);$i<$m;$i++) {
$c=ord($s[$i]);
if ($c>127) // convert only special chars
if ($c==184) $t.=chr(209).chr(209); // small io
elseif ($c==168) $t.=chr(208).chr(129); // capital io
else $t.=($c>239?chr(209):chr(208)).chr($c-48);
else $t.=$s[$i];
}
return $t;
}
?>
Hope this helps
--was--
previous bit of code (grmaxim's win_to_utf8 function) didn't work for me, so I wrote my
own func to convert from win1251 to utf8:
function win2utf($s) {
for($i=0,$m=strlen($s);$i<$m;$i++) {
$c=ord($s[$i]);
if ($c>127) // convert only special chars
if ($c==184) $t.=chr(209).chr(209); // small io
elseif ($c==168) $t.=chr(208).chr(129); // capital io
else $t.=($c>239?chr(209):chr(208)).chr($c-48);
else $t.=$s[$i];
}
return $t;
}
Hope this helps
http://php.net/manual/en/function.convert-cyr-string.php