ID: 36738 User updated by: yanick dot rochon at gmail dot com Reported By: yanick dot rochon at gmail dot com Status: Bogus Bug Type: DOM XML related Operating System: Windows XP PHP Version: 5.1.2 New Comment:
Well, I'm sorry if you guys think that this is not a bug, but it is still a problem to me. I've read many forums talking about this issue, and all the possible solution they came up with was to play with char encodings... What I fail to see is, why htmlentities('<clé>'); would output '<clé>' and new DOMText( '<clé>' ); would output '<clé>' ? Since there's no option to prevent the text in being escaped, I had to fall back into raw XML editing (strings instead of DOM), making the whole DOM package obsolete to me. Could there be a mechanism to prevent saveXML to escape the text nodes ? So people can actually control what is being escaped, and what's not ? If this is just not possible, please let me know, because I don't see why it couldn't be implemented. Thanks. P.s. I did read the rules for posting bugs and reports. And I was pretty sure I did it right. Previous Comments: ------------------------------------------------------------------------ [2006-03-15 10:48:42] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ [2006-03-14 23:07:20] yanick dot rochon at gmail dot com Description: ------------ When using letter with accents (ie: 'é', 'è', 'à', etc.) there is no way to use the htmlentities() function or any form of special character encoding correctly. Or the browser (mostly IE) will refuse to read the XML (FF is just fine) or, if using htmlentities(), the '&' in 'é' will because '&eacute;' which is not desired. Reproduce code: --------------- $doc = new DOMDocument('1.0','UTF-8'); $node1 = $doc->createElement('node'); $node1->appendChild( new DOMText( 'clé' ) ); $node2 = $doc->createElement('node'); $node2->appendChild( new DOMText( htmlentities('clé') ) ); $root = $doc->createElement('xml'); $root->appendChild( $node ); $doc->appendChild( $root ); echo $doc->saveXML(); Expected result: ---------------- <?xml version="1.0" encoding="utf-8" ?> <xml> <node>é</node> <node>é</node> </xml> Actual result: -------------- <?xml version="1.0" encoding="utf-8" ?> <xml> <node>é</node> <node>&eacute;</node> </xml> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36738&edit=1