#36738 [Opn->Bgs]: Encoding with accents using htmlentities

From: Date: Wed, 15 Mar 2006 09:48:43 +0000
Subject: #36738 [Opn->Bgs]: Encoding with accents using htmlentities
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94362@lists.php.net to get a copy of this message
 ID:               36738
 Updated by:       edink@php.net
 Reported By:      yanick dot rochon at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: Windows XP
 PHP Version:      5.1.2
 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




Previous Comments:
------------------------------------------------------------------------

[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 'é' 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>&eacute;</node>
</xml>


Actual result:
--------------
<?xml version="1.0" encoding="utf-8" ?>
<xml>
<node>é</node>
<node>&amp;eacute;</node>
</xml>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36738&edit=1


Thread (3 messages)

« previous php.bugs (#94362) next »