Edit report at https://bugs.php.net/bug.php?id=31994&edit=1
ID: 31994
Comment by: michal dot vrchota at gmail dot com
Reported by: misnet at hotmail dot com
Summary: output conversion failed due to conv error
Status: No Feedback
Type: Bug
Package: XSLT related
Operating System: windows 2003 server
PHP Version: 5CVS-2005-02-25
Block user comment: N
Private report: N
New Comment:
Check if You are not using binary unsafe functions. I was calling substr()
instead
of mb_substr() which broke the utf8 encoding.
Previous Comments:
------------------------------------------------------------------------
[2007-05-20 17:02:14] bonsite at hotmail dot com
This is not a PHP error. You must use utf8_encode() when you use characters
like é, ë, ...
------------------------------------------------------------------------
[2007-04-26 21:40:36] scott at realorganized dot com
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);
?>
Character code 200 is an e grave and is a valid iso-8859-1
character. 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
------------------------------------------------------------------------
[2005-04-17 01:00:06] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2005-04-09 17:34:52] [email protected]
You're probably using a character which can not be represented in iso-8859-1...
but I don't know for sure as I don't have the data. Come up with a
*self-contained* script that does not rely on a database...
------------------------------------------------------------------------
[2005-04-09 08:27:21] cbdbs at yahoo dot com
$doc = new DOMDocument('1.0','ISO-8859-1');
// we want a nice output
$doc->formatOutput = true;
$familias = $doc->appendChild(new DOMElement('familias'));
while ($fam_datos = mysql_fetch_array($data)){
$familia = $familias->appendChild(new DOMElement('familia'));
$familia->appendChild(new DOMElement('Apellidos',
$fam_datos['Familia']));
$familia->appendChild(new DOMElement('Representante',
$fam_datos['Apellidos']));
$familia->appendChild(new DOMElement('Nombre',
$fam_datos['Nombres']));
$familia->appendChild(new DOMElement('Edad',
$fam_datos['Edad']));
$familia->appendChild(new DOMElement('Salud', 'Sano'));
}
header('Content-Type: text/xml');
$documento = $doc->saveXML();
echo $documento;
OUTPUT
<b>Warning</b>: output conversion failed due to conv error in
<b>c:\home\prueba\www\grid\xml.php</b>...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=31994
--
Edit this bug report at https://bugs.php.net/bug.php?id=31994&edit=1