ID: 26650 Updated by: [EMAIL PROTECTED] Reported By: msw at seebi dot de -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: Win XP Prof PHP Version: 4.3.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Any kinds of characters like "&" that have special meanings in the XML document will be escaped during the serialization. There's no such specification that defines entity-like strings to be handled specially. If you want to use strings that contain a special character which cannot be represented by the encoding your script uses, or which cannot be entered via your keyboard, you need to convert the string to the appropriate encoding (UTF-8) first and then pass it to the DOM facility, as DOM extension assumes all passed strings are encoded in UTF-8 internally. Previous Comments: ------------------------------------------------------------------------ [2003-12-22 08:18:21] msw at seebi dot de As you suggested, I've checked out the new stable release. The result is the same, each character '&' is converted into &. ------------------------------------------------------------------------ [2003-12-18 03:11:27] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-12-17 10:18:16] msw at seebi dot de Description: ------------ When I'm producing a new xml file (domxml_new_doc()) which contains some decimal entities (e.g. for the german characters ß Ä ö and so on) and saving this file to disk (dump_file()) each character '&' in each decimal entity is converted into &. This appears with PHP 4.3.0 and 4.3.4 (Win). PHP 4.3.1, 4.3.2 and 4.3.3 not tested. Reproduce code: --------------- <?php $content="ß - Ä"; $dom = domxml_new_doc("1.0"); $root = $dom->add_root("list"); $ab=$dom->create_element("absatz"); $ab->set_attribute("id","10"); $text=$dom->create_element("text"); $content=$dom->create_text_node($content); $text->append_child($content); $ab->append_child($text); $root->append_child($ab); $dom->dump_file("test.xml", false, false); ?> Expected result: ---------------- the file test.xml should look like this: <?xml version="1.0"?> <list><absatz id="10"><text>ß -Ä</text></absatz></list> Actual result: -------------- The actual result is: <?xml version="1.0"?> <list><absatz id="10"><text>&#223; -&#196;</text></absatz></list> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26650&edit=1