我使用PHP dom删除一些类和id, 但这也是将我的俄语转换为实体(除英语之外的所有其他语言都转换为实体)。
像:
контекстное = контекÑÑ‚
当我看到源代码时,我看到了这一点:
конÑ
如何停止dom将我的语言转换为实体。 谢谢你的帮助。
答案 0 :(得分:0)
在php.net上查看this评论。
引用:
You can also load HTML as UTF-8 using this simple hack:
<?php
$doc = new DOMDocument();
$doc->loadHTML('<?xml encoding="UTF-8">' . $html);
// dirty fix
foreach ($doc->childNodes as $item)
if ($item->nodeType == XML_PI_NODE)
$doc->removeChild($item); // remove hack
$doc->encoding = 'UTF-8'; // insert proper
?>