note 79829 deleted from function.unicode-encode by danbrown

From: Date: Mon, 12 Apr 2010 17:12:05 +0000
Subject: note 79829 deleted from function.unicode-encode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168166@lists.php.net to get a copy of this message
Note Submitter: berlioz at nicematin dot fr ---- 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; } ?>

« previous php.notes (#168166) next »