note 79829 added to function.unicode-encode
| From: | berlioz at nicematin dot fr | Date: | Fri, 14 Dec 2007 13:37:17 +0000 |
| Subject: | note 79829 added to function.unicode-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133453@lists.php.net to get a copy of this message | ||
a little usefull function
<?php
function unicode2utf8($c)
{
$output="";
if($c < 0x80)
{
return chr($c);
}
else if($c < 0x800)
{
return chr( 0xc0 | ($c >> 6) ).chr( 0x80 | ($c & 0x3f) );
}
else if($c < 0x10000)
{
return chr( 0xe0 | ($c >> 12) ).chr( 0x80 | (($c >> 6) & 0x3f) ).chr( 0x80 | ($c
& 0x3f) );
}
else if($c < 0x200000)
{
return chr(0xf0 | ($c >> 18)).chr(0x80 | (($c >> 12) & 0x3f)).chr(0x80 | (($c
>> 6) & 0x3f)).chr(0x80 | ($c & 0x3f));
}
return false;
}
?>
----
Server IP: 195.221.21.36
Probable Submitter: 88.176.172.158
----
Manual Page -- http://www.php.net/manual/en/function.unicode-encode.php
Edit -- https://master.php.net/note/edit/79829
Del: integrated -- https://master.php.net/note/delete/79829/integrated
Del: useless -- https://master.php.net/note/delete/79829/useless
Del: bad code -- https://master.php.net/note/delete/79829/bad+code
Del: spam -- https://master.php.net/note/delete/79829/spam
Del: non-english -- https://master.php.net/note/delete/79829/non-english
Del: in docs -- https://master.php.net/note/delete/79829/in+docs
Del: other reasons-- https://master.php.net/note/delete/79829
Reject -- https://master.php.net/note/reject/79829
Search -- https://master.php.net/manage/user-notes.php