note 72978 added to function.utf8-decode

From: Date: Tue, 06 Feb 2007 16:20:52 +0000
Subject: note 72978 added to function.utf8-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-122928@lists.php.net to get a copy of this message
In addition to yannikh's note, to convert a hex utf8 string <?php echo utf8_decode("\x61\xc3\xb6\x61"); // works as expected $abc="61c3b661"; $newstr = ""; $l = strlen($abc); for ($i=0;$i<$l;$i+=2){ $newstr .= "\x".$abc[$i].$abc[$i+1]; } echo utf8_decode($newstr); // or varieties of "\x": "\\x" etc does NOT output what you want echo utf8_decode(pack('H*',$abc)); // this outputs the correct string, like the first line. ?> ---- Server IP: 83.138.144.80 Probable Submitter: 195.188.254.61 ---- Manual Page -- http://www.php.net/manual/en/function.utf8-decode.php Edit -- https://master.php.net/note/edit/72978 Del: integrated -- https://master.php.net/note/delete/72978/integrated Del: useless -- https://master.php.net/note/delete/72978/useless Del: bad code -- https://master.php.net/note/delete/72978/bad+code Del: spam -- https://master.php.net/note/delete/72978/spam Del: non-english -- https://master.php.net/note/delete/72978/non-english Del: in docs -- https://master.php.net/note/delete/72978/in+docs Del: other reasons-- https://master.php.net/note/delete/72978 Reject -- https://master.php.net/note/reject/72978 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122928) next »