note 25714 added to function.utf8-encode
| From: | romans at void dot lv | Date: | Wed, 02 Oct 2002 23:59:05 +0000 |
| Subject: | note 25714 added to function.utf8-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37588@lists.php.net to get a copy of this message | ||
Here is optimized function which converts binary UTF symbol code into unicoded string.
function code2utf($num){
if($num<128)return chr($num);
if($num<1024)return chr(($num>>6)+192).chr(($num&63)+128);
if($num<32768)return
chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128);
if($num<2097152)return
chr($num>>18+240).chr((($num>>12)&63)+128).chr(($num>>6)&63+128).
chr($num&63+128);
return '';
}
--
http://www.php.net/manual/en/function.utf8-encode.php
http://master.php.net/manage/user-notes.php?action=edit+25714
http://master.php.net/manage/user-notes.php?action=delete+25714
http://master.php.net/manage/user-notes.php?action=reject+25714