note 94131 deleted from function.unicode-encode by danbrown

From: Date: Mon, 12 Apr 2010 17:11:59 +0000
Subject: note 94131 deleted from function.unicode-encode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168165@lists.php.net to get a copy of this message
Note Submitter: Nicolae Namolovan ---- Want to display the acutal character represented by Unicode Code Annotation U+.. for example U+00CE ? The unicode_to_utf8 you find in comments futher will help us, but it requires as argument an array of integers, 00CE in our example (and the unicode notation) is hex, everything we need to do is to apply the hexdec function to convert it to decimal. <?php echo unicode_to_utf8(array(hexdec("00CE"))); // Result: Î ?> Or a handy function that will take U+00CE and will make the same thing <?php function unicodeCodePointToChar($str) { if (substr($str,0,2) != 'U+') return $str; $str = substr($str,2); // Skip U+ return unicode_to_utf8(array(hexdec($str))); } echo unicodeCodePointToChar("U+00CE"); // Result: Î ?> Hopefully that will help someone like me ;)

« previous php.notes (#168165) next »