ID: 38483 Updated by: [EMAIL PROTECTED] Reported By: webmaster at bison-soft dot de -Status: Open +Status: Assigned Bug Type: DOM XML related Operating System: linux 2.4 PHP Version: 5.1.4 -Assigned To: +Assigned To: rrichards
Previous Comments: ------------------------------------------------------------------------ [2006-08-17 14:04:26] webmaster at bison-soft dot de Description: ------------ An XML-String appended to a DOMDocumentFragment with appendXML() must always be encoded with UTF-8, regardless of the choosen DOMDocument encoding. Even worse, after appending the fragment to the document, the charset in the fragment remains UTF-8, which leads to a DOMDocument with mixed encodings inside. Reproduce code: --------------- $dom = new DOMDocument('1.0','ISO-8859-1'); $dom->loadXML('<parent />'); $frag = $dom->createDocumentFragment(); $frag->appendXML('<child>öäü</child>'); $dom->documentElement->appendChild($frag); Expected result: ---------------- the ISO-8859-1 encoded XML-String will cleanly import into the document fragment. Actual result: -------------- Error: DOMDocumentFragment::appendXML() Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding !! When trying to use an XML-declaration containing the ISO-8859-1 encoding in the child-XML-String: Entity: line 1: parser error : XML declaration allowed only at the start of the document When you convert the child-XML-String to utf8 and append it, you have a DOMDocument with mixed charset ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38483&edit=1