note 49960 added to function.convert-cyr-string
| From: | felix | Date: | Sun, 13 Feb 2005 20:57:18 +0000 |
| Subject: | note 49960 added to function.convert-cyr-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84939@lists.php.net to get a copy of this message | ||
Check this code -- exelent to convert win-1251 to UTF-8
just one fix!!!
if ($c==184) { $t.=chr(209).chr(145); continue; };
Anything more it is not necessary.
It is grateful to threed [at] koralsoft.com
28-Jul-2003 03:37
i tried all functions here to convert from cp1251 to unicode, but they don't work. i think that
this work :
<?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+49960
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49960&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49960&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49960&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49960&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49960&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49960&report=yes
Search -- http://master.php.net/manage/user-notes.php