simplexml weird characters
Posted: Fri Aug 21, 2009 5:12 pm
I am trying to parse an XML document. I am using the following code (I only want the first entry).
On the feed itself it looks fine, but the above code outputs (notice the odd characters) :
I thought I had this issue before and the solution was to use utf-8 character encoding, so I tried specifying it using both an html doctype and header() - neither worked. When I view the source of the XML document it has:
I'm not sure what to do?
Code: Select all
<?php
$xml = new SimpleXMLElement('http://www.example.com/feed/', null, true);
echo $xml->channel->item->title[0];
?>On the feed itself it looks fine, but the above code outputs (notice the odd characters) :
Code: Select all
LOL Monday – Selective LudditeI thought I had this issue before and the solution was to use utf-8 character encoding, so I tried specifying it using both an html doctype and header() - neither worked. When I view the source of the XML document it has:
Code: Select all
<title>LOL Monday – Selective Luddite</title>