开发者

SimpleXMLElement and encoding problems

开发者 https://www.devze.com 2023-02-10 20:51 出处:网络
I load a RSS (X开发者_运维技巧ML) document into an SimpleXmlElement the following way: $x = new SimpleXmlElement($content);

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号