I have a class that uses SimpleXML to parse a raw XML feed from Wordpress (RSS2 format) and have a problem with the way SimpleXML handles the HTML entity for an apostrophe. Here's my code:
// step 1: get the feed
$rawFeed = file_get_contents($this->blog_url);
$xml = new SimpleXmlElement($rawFeed);
As soon as I load my XML into a SimpleXML object, it converts all occurances of
’
into
’
. I cannot figure out what combination of flags to pass to the constructor to keep this from happening. I know it has something to do with character encoding, but I've made sure the database is UTF8 and wordpress is outputting the feed in UTF8. So I have no idea why the characters are getting converted to something else by PHP's SimpleXML object.