|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-04-26 22:17 UTC] scott at realorganized dot com
[2007-04-26 23:45 UTC] tony2001@php.net
[2007-04-27 09:27 UTC] rrichards@php.net
[2010-09-13 23:04 UTC] r dot spliet at student dot tudelft dot nl
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 21:00:01 2025 UTC |
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