JMC*_*JMC 8 php encoding phpquery
有没有办法通过phpquery :: newDocument运行这个html标记后修复显示不正确的字符?在使用phpquery创建新文档后,原始文档中的-Classics和现代Woman之间会出现双引号.
//Original document is UTF-8 encoded
$raw_html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body><p>Mr. Smith of Bangkok celebrated the “Classics with modern Woman”.</p></body></html>';
print($raw_html);
$aNew_document = phpQuery::newDocument($raw_html);
print($aNew_document);
Run Code Online (Sandbox Code Playgroud)
原始输出:曼谷史密斯先生庆祝"与现代女性的经典".
新文件输出:曼谷史密斯先生与现代女性一起庆祝"经典".
sha*_*mar 25
UTF-8 without BOM编码保存页面. 在脚本顶部添加此标头:
header("Content-Type: text/html; charset=UTF-8");
[编辑]:如何在没有BOM的情况下将文件保存为UTF-8:
在OP请求中,您可以在Windows上执行以下操作: