#41208 [NEW]: saveXML() fails with iso-8859-1 input
| From: | scott at realorganized dot com | Date: | Thu, 26 Apr 2007 21:53:54 +0000 |
| Subject: | #41208 [NEW]: saveXML() fails with iso-8859-1 input | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-111973@lists.php.net to get a copy of this message | ||
From: scott at realorganized dot com
Operating system: Mac OS X, Linux
PHP version: 5.2.1
PHP Bug Type: DOM XML related
Bug description: saveXML() fails with iso-8859-1 input
Description:
------------
When using input encoding of charset=iso-8859-1 domDocument()
fails to output the ascii code 200 (e grave) using saveXML()
Reproduce code:
---------------
Here's some example code that shows the problem:
<?
header("Content-Type: text/html; charset=iso-8859-1");
error_reporting(E_ALL);
$domfather = new domDocument('1.0', 'iso-8859-1');
$node = $domfather->createElement("xxx", chr(200));
$domfather->appendChild($node);
echo "<pre>";
echo htmlspecialchars($domfather->saveXML());
$nodelist = $domfather->getElementsByTagName("xxx");
$data = $nodelist->item(0)->nodeValue;
echo $data;
echo strlen($data);
?>
Expected result:
----------------
I was expecting the saveXML() to output the e grave symbol (ascii
200)
iso-8859-1 character mapping is here:
http://old.no/charmap/iso-8859-1.html
and shows that ascii is completely valid.
Please notice that the data is provided correctly when I ask for
it by node. the failure is just when using the saveXML()
function.
Actual result:
--------------
The output from my server is below. When I retrieve
the node's data back, it is as expected. But it's the saveXML()
code that seems to have a problem. I suspect the problem is with
the utf-8 -> iso-8859 conversion before output.
Warning: DOMDocument::saveXML() [function.DOMDocument-saveXML]:
output conversion failed due to conv error in /Library/Tenon/
WebServer/WebSites/realtyjuggler.com/subscription/test.php on line
23
Warning: DOMDocument::saveXML() [function.DOMDocument-saveXML]:
Bytes: 0xC8 0x3C 0x2F 0x78 in /Library/Tenon/WebServer/WebSites/
realtyjuggler.com/subscription/test.php on line 23
<?xml version="1.0" encoding="iso-8859-1"?>
<xxx>È1
--
Edit bug report at http://bugs.php.net/?id=41208&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41208&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41208&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41208&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41208&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41208&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41208&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41208&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41208&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41208&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41208&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41208&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41208&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41208&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41208&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41208&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41208&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41208&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41208&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41208&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41208&r=mysqlcfg