#36263 [Csd->Bgs]: DOM XML breaks on copyright character in text node
| From: | tony2001@php.net | Date: | Thu, 02 Feb 2006 19:56:41 +0000 |
| Subject: | #36263 [Csd->Bgs]: DOM XML breaks on copyright character in text node | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92846@lists.php.net to get a copy of this message | ||
ID: 36263
Updated by: tony2001@php.net
Reported By: thom at genx dot net
-Status: Closed
+Status: Bogus
Bug Type: DOM XML related
Operating System: Linux (gentoo)
PHP Version: 5.1.2
Previous Comments:
------------------------------------------------------------------------
[2006-02-02 20:47:13] thom at genx dot net
Thank you. That fixed the problem I was having. I do apologize for
having skipped over the user contributed notes, but I did try other
encoding functions (just not utf8_encode()). It is also strange that I
did not get any warnings or errors as reported in the user notes (error
reporting set at E_ALL).
Thanks again.
------------------------------------------------------------------------
[2006-02-02 19:52:04] rrichards@php.net
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
utf8 encode the character. And no it wont output © thats an HTML
entity.
------------------------------------------------------------------------
[2006-02-02 19:13:04] thom at genx dot net
Description:
------------
When a copyright character (ascii 169) is present in a string that is
added as a text node to the DOM structure, the element is always empty.
The correct behavior is to encode the character as "©".
Reproduce code:
---------------
<?php
$doc = new DOMDocument('1.0');
$t = $doc->appendChild($doc->createElement('test'));
$t->appendChild($doc->createTextNode('&' . chr(169) . '<'));
header('Content-type: text/xml');
echo $doc->saveXML();
?>
Expected result:
----------------
<?xml version="1.0"?>
<test>&©<</test>
Actual result:
--------------
<?xml version="1.0"?>
<test></test>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36263&edit=1