如何将XML实体转换回字符

I'm working with XML files, and sometimes I'm facing with an XML encoding problem, for example, instead of ö I'm getting ö. How can I fix this in php?

Use html_entity_decode(), example (from PHP manual):

$orig = "I'll \"walk\" the <b>dog</b> now";

$a = htmlentities($orig);

$b = html_entity_decode($a);

echo $a; // I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now

echo $b; // I'll "walk" the <b>dog</b> now

And your case specifically is covered here: http://codepad.viper-7.com/4DIrsM

NB: The function's 3rd parameter is the character set encoding. By default it is ISO-8859-1 (according to PHP manual), but most websites are in UTF-8, so you need to set the parameter yourself as I did above.