note 38574 added to function.convert-cyr-string
| From: | aeon at rn2 dot php dot net | Date: | Sun, 28 Dec 2003 01:20:59 +0000 |
| Subject: | note 38574 added to function.convert-cyr-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62590@lists.php.net to get a copy of this message | ||
threed's function works great, but the replacement for the letter small io (ё) needs
to be changed from
<?php
if ($c==184) { $t.=chr(209).chr(209); continue; };
?>
to
<?php
if ($c==184) { $t.=chr(209).chr(145); continue; };
?>
so, the final working result should look like this:
<?php
function win3utf($s) {
for($i=0, $m=strlen($s); $i<$m; $i++) {
$c=ord($s[$i]);
if ($c<=127) {$t.=chr($c); continue; }
if ($c>=192 && $c<=207) {$t.=chr(208).chr($c-48); continue; }
if ($c>=208 && $c<=239) {$t.=chr(208).chr($c-48); continue; }
if ($c>=240 && $c<=255) {$t.=chr(209).chr($c-112); continue; }
if ($c==184) { $t.=chr(209).chr(209); continue; };
if ($c==168) { $t.=chr(208).chr(129); continue; };
}
return $t;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.convert-cyr-string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38574
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38574&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38574&report=yes
Search -- http://master.php.net/manage/user-notes.php