SimpleXMLElement and encoding problems
I load a RSS (X开发者_运维技巧ML) document into an SimpleXmlElement the following way:
$x = new SimpleXmlElement($content);
I'we also tested with:
$x = simplexml_load_string($content);
When I print out the $content the encoding is correct but when I load it into an SimpleXmlElement and print it out, I get things like; 'være' instead of 'være'.
Any idea how to fix this?
Also, extra question, the SimpleXmlElement seems slow, any way to speed it up?
[Edit]
RSS source: http://www.vg.no/rss/nyfront.php?frontId=1
And it seems that it was something else that was my bottle neck (the foreach running trough all of my RSS news entries).
Found it. Need to use utf8_decode().
Refrence: http://lists.motion-twin.com/pipermail/phptal/2005-March/000316.html
精彩评论