简体   繁体   English

文档标记为 UTF-16,但在实体 PHP 错误中包含 UTF-8 内容

[英]Document labelled UTF-16 but has UTF-8 content in Entity PHP error

I recently transferred my site to PHP5.3 from PHP5.2.我最近将我的网站从 PHP5.2 转移到 PHP5.3。 I had in place an authentication module which was working fine earlier but now gives the error我有一个身份验证模块,该模块之前工作正常,但现在出现错误

Document labelled UTF-16 but has UTF-8 content in Entity

I have tried replacing all occurrences of UTF-8 with UTF-16 but that did not help.我尝试用 UTF-16 替换所有出现的 UTF-8 但这没有帮助。 What could be the possible solutions / causes of this error?此错误的可能解决方案/原因是什么?

See this:看到这个:

http://forums.devshed.com/php-development-5/document-labelled-utf-16-but-has-utf-8-content-694388.html http://forums.devshed.com/php-development-5/document-labelled-utf-16-but-has-utf-8-content-694388.html

Solution from this link simply replaces encoding information in the XML code:此链接的解决方案只是替换 XML 代码中的编码信息:

$xml = $result->GetWeatherResult;
$xml = preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $xml);  

Not a nice solution, but worked for OP.不是一个好的解决方案,但适用于 OP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM