php: using DomDocument whenever I try to write UTF-8 it writes the hexadecimal notation of it

前端 未结 6 943
清歌不尽
清歌不尽 2020-11-27 21:41

When I try to write UTF-8 Strings into an XML file using DomDocument it actually writes the hexadecimal notation of the string instead of the string itself.

for exam

6条回答
  •  难免孤独
    2020-11-27 22:20

    Apparently passing the documentElement as $node to saveXML works around this, although I can't say I understand why.

    e.g.

    $dom->saveXML($dom->documentElement);
    

    rather than:

    $dom->saveXML();
    

    Source: http://www.php.net/manual/en/domdocument.savexml.php#88525

提交回复
热议问题