php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16993 Characters with ascii>127 crash
Submitted: 2002-05-03 09:47 UTC Modified: 2002-06-02 18:51 UTC
From: rici at aporisk dot hu Assigned:
Status: Closed Package: Sablotron XSL
PHP Version: 4.2.0 OS: Windows 2000
Private report: No CVE-ID: None
 [2002-05-03 09:47 UTC] rici at aporisk dot hu
Possible bug in xslt_process()

If in the source xml code are characters with ascii code greater than 127, for example some national characters (?, ?, ...), they will not be displayed correctly in the result after the transformation. Instead the character I get two strange characters. For a specified source character (>127) I always get specified characters. Of course, in the xml tag I use the correct encoding attribute, for example ISO-8859-2.

Thanks.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-03 10:00 UTC] cynic@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

 [2002-05-04 05:09 UTC] rici at aporisk dot hu
To better explain, here is an example source:

<?
$xml = <<< END
<?xml version="1.0" encoding="ISO-8859-2"?>
<ROOT>
<IMPORTANT>Very important ? ? ? </IMPORTANT>
</ROOT>
END;

$xsl = <<<END
<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="ROOT">
  <B><xsl:value-of select="IMPORTANT"/></B>
</xsl:template>
</xsl:stylesheet>
END;

$arguments = array('/_xml' => $xml,'/_xsl' => $xsl);
$xh = xslt_create();
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
echo $result;
?>

And, I think, the good result is: <B>Very important ? ? ?</B>
But I always get: <B>Very important ö ü é</B>
 [2002-05-06 11:12 UTC] rici at aporisk dot hu
And I tried it with the command line version of php, and the result is the same.
 [2002-06-02 18:51 UTC] k.schroeder@php.net
This looks like an encoding problem.

Use <xsl:output method="html" encoding="utf-8"/>
or header("Content-type: text/html; charset=utf-8"); to give the right encoding to your browser. This works for me.

Processing output direct with sabcmd from your xml and xsl documents show the same as described from you. So I think, that's a sablotron problem and not a PHP bug. Feel free to reopen, if my tip doesn't work for you.

Regards, Kai
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 21:01:27 2024 UTC