【发布时间】:2011-03-16 12:21:52
【问题描述】:
我正在使用 simplexml_load_file 方法来解析来自外部源的提要。
我的代码是这样的
$rssFeed['DAILYSTAR'] = 'http://www.thedailystar.net/latest/rss/rss.xml'; $rssParser = simplexml_load_file($url);
输出如下:
警告:simplexml_load_file() [function.simplexml-load-file]:http://www.thedailystar.net/latest/rss/rss.xml:12:解析器错误:输入不正确的 UTF-8,表示编码!字节:第 39 行 C:\xampp\htdocs\googlebd\index.php 中的 0x92 0x73 0x20 0x48
最终因致命错误而停止。主要问题是该站点的字符编码是 ISO-8859-1,而不是 UTF-8。
我可以使用这种方法(SimpleXML API)读取这个吗? 如果没有,那么还有其他方法可用吗? 我已经通过谷歌搜索但没有答案。我应用的每个方法都返回此错误。
谢谢, 皮疹
【问题讨论】:
标签: utf-8 rss character-encoding