note 94131 added to function.unicode-encode

From: Date: Sun, 18 Oct 2009 12:17:58 +0000
Subject: note 94131 added to function.unicode-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-161851@lists.php.net to get a copy of this message
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. echo unicode_to_utf8(array(hexdec("00CE"))); // Result: Î Or a handy function that will take U+00CE and will make the same thing 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 ;) ---- Server IP: 69.147.83.197 Probable Submitter: 92.51.135.117 ---- Manual Page -- http://www.php.net/manual/en/function.unicode-encode.php Edit -- https://master.php.net/note/edit/94131 Del: integrated -- https://master.php.net/note/delete/94131/integrated Del: useless -- https://master.php.net/note/delete/94131/useless Del: bad code -- https://master.php.net/note/delete/94131/bad+code Del: spam -- https://master.php.net/note/delete/94131/spam Del: non-english -- https://master.php.net/note/delete/94131/non-english Del: in docs -- https://master.php.net/note/delete/94131/in+docs Del: other reasons-- https://master.php.net/note/delete/94131 Reject -- https://master.php.net/note/reject/94131 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161851) next »