note 92969 added to function.simplexml-load-file

From: Date: Mon, 17 Aug 2009 13:00:05 +0000
Subject: note 92969 added to function.simplexml-load-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-159563@lists.php.net to get a copy of this message
Because the encoding of my XML file is UTF-8 and the encoding of my web page is iso-8859-1 I was getting strange characters such as ’ instead of a right single quote. The solution to this turned out to be hard to find, but really easy to implement. http://uk3.php.net/manual/en/function.iconv.php Using the iconv() function you can convert from one encodign to another, the TRANSLIT option seems to work best for what I needed. Here's my example: <?php // convert string from utf-8 to iso8859-1 $horoscope = iconv( "UTF-8", "ISO-8859-1//TRANSLIT", $horoscope ); ?> I found the solution on this page... http://tinyurl.com/lm39xc Hope this helps ---- Server IP: 87.124.86.47 Probable Submitter: 82.71.228.44 (proxied: 82.71.228.44) ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-load-file.php Edit -- https://master.php.net/note/edit/92969 Del: integrated -- https://master.php.net/note/delete/92969/integrated Del: useless -- https://master.php.net/note/delete/92969/useless Del: bad code -- https://master.php.net/note/delete/92969/bad+code Del: spam -- https://master.php.net/note/delete/92969/spam Del: non-english -- https://master.php.net/note/delete/92969/non-english Del: in docs -- https://master.php.net/note/delete/92969/in+docs Del: other reasons-- https://master.php.net/note/delete/92969 Reject -- https://master.php.net/note/reject/92969 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159563) next »