|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-04-21 14:37 UTC] troelskn at gmail dot com
Description: ------------ After some digging around and experimentation, I have found out that the DOM extension needs all input strings to be utf8-encoded. This means that any code using the extension must be spingled with urf8_encode. The problem can probably not be fixed without breaking backward compatibility, so the most sane choice may be to leave it, but atleast update the documentation to state this. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
Not true. $mb_detect_charsets = "ASCII,UTF-8,ISO-8859-1"; $dom = new DOMDocument("1.0", "UTF-8"); $doc = $dom->appendChild($dom->createElement("document")); $doc->appendChild($dom->createTextNode(utf8_encode("I?t?rn?ti?n?liz?ti?n"))); echo mb_detect_encoding($dom->saveXML(), $mb_detect_charsets) . "<br>"; $dom = new DOMDocument("1.0", "ISO-8859-1"); $doc = $dom->appendChild($dom->createElement("document")); $doc->appendChild($dom->createTextNode(utf8_encode("I?t?rn?ti?n?liz?ti?n"))); echo mb_detect_encoding($dom->saveXML(), $mb_detect_charsets) . "<br>"; ------------------------------------------------------- outputs : UTF-8 ISO-8859-1 ------------------------------------------------------- Removing ut8_encode crashes the second example.