开发者

Zend_Config_XML encoding issue

I am creating a XML navigation for my website. This line below is causing a simpleXML issue:

<label>Osnabr&Atilde;&frac14;ck</label>

My PHP code, using HTMLentities has changed Osnabrück into Osnabrück. However, when trying to parse my XML with this line in it, I get this error:

/application/configs/navigation.xml:318: parser error : Entity 'Atilde' not defined simplexml_load_file()

开发者_JAVA技巧

Should I not be using htmlentities()? Or is there some kind of setting I'm missing?

Kind Regards

Steve


You should not be using HTML Entities in XML. Using normal UTF-8 characters should be fine.

The occurrence of Osnabrück means that at some point, most likely, the city name is processed as ISO-8859-1 instead of UTF-8. It is not htmlentities()'s fault. You need to find that point and fix it.


You can use iconv() function to convert to utf-8 dynamicaly.

iconv("ISO-8859-1", "UTF-8", $text);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜