simplexml_load_string() 不喜欢外语
我收到了一个 XML 响应,该响应完美地完成了。
“português”和“españa”等单词的格式正确。
然而,一旦我通过 php 函数 simplexml_load_string()
解析了 XML,单词就会转换如下:“portugu�s”和“espa�a”。
I am receiving an XML response which comes through perfectly.
Words such as "português" and "españa" are correctly formatted.
However, once I have parsed the XML through the php function simplexml_load_string()
, the words are transformed as follows: "portugu�s" and "espa�a".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Simple XML 始终在内部将文本视为 UTF-8 编码,并在必要时与该字符集进行相互转换。要解决您的问题,请确保应用程序的所有输出都是 UTF-8 编码或将其转换为其他字符集(可能使用 utf8decode())。
Simple XML always treats text internally as UTF-8 encoded, converting to and from this character set if necessary. To solve your issue either make sure that all output from your app is UTF-8 encoded or convert it to another character set (possibly using utf8decode()).