From: yanick dot rochon at gmail dot com Operating system: Windows XP PHP version: 5.1.2 PHP Bug Type: DOM XML related Bug description: Encoding with accents using htmlentities
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 bug report at http://bugs.php.net/?id=36738&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36738&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36738&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36738&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36738&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36738&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36738&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36738&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36738&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36738&r=support Expected behavior: http://bugs.php.net/fix.php?id=36738&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36738&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36738&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36738&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36738&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36738&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36738&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36738&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36738&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36738&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36738&r=mysqlcfg