#36407 [NEW]: Encoding in xsl:output has no effect

From: Date: Thu, 16 Feb 2006 01:10:24 +0000
Subject: #36407 [NEW]: Encoding in xsl:output has no effect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93310@lists.php.net to get a copy of this message
From: memoimyself at yahoo dot com dot br Operating system: Windows XP PHP version: 5.1.2 PHP Bug Type: XSLT related Bug description: Encoding in xsl:output has no effect Description: ------------ I have an XSL file to transform XML documents; the XSL and all XML files are encoded in UTF-8. My PHP script is in a file also encoded in UTF-8. The data is retrieved from a database (MySQL 5) whose character set is UTF-8 and whose tables all have UTF-8 as their character set as well. All the strings in all the tables are duly encoded in UTF-8. Prior to data retrieval, the query 'SET NAMES "utf8"' is run to ensure that all i/o operations use the same character set (UTF-8). (Hope I've been thorough enough!) Now, my XSL file has the following top-level (child node of the document element, as it should be) element: <xsl:output encoding="utf-8" method="html"/> The transformation is performed by the transformToXML method of the XSLTProcessor class. When the code is run on a Windows server (Win XP, Apache 2.0.55,PHP 5.1.2), the result of the transformation is NEVER UTF-8 (always iso-8859-1), even if I chage 'method' to 'xml', and even if I use a 'media-type' attribute. When run on a Linux server (PHP 5.1.2 as well), everything goes well. Reproduce code: --------------- $xml = new DOMDocument('1.0', 'UTF-8'); $xml->loadXML($row->Report); $xsl = new DOMDocument('1.0', 'UTF-8'); $xsl->load($xsl_file); $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); $report = $proc->transformToXML($xml); Expected result: ---------------- Output string should be encoded in UTF-8. Actual result: -------------- Output string in NOT encoded in UTF-8 and accented characters appear garbled. This problem only occurs under Windows. -- Edit bug report at http://bugs.php.net/?id=36407&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36407&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36407&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36407&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36407&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36407&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36407&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36407&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36407&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36407&r=support Expected behavior: http://bugs.php.net/fix.php?id=36407&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36407&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36407&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36407&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36407&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36407&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36407&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36407&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36407&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36407&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36407&r=mysqlcfg

« previous php.bugs (#93310) next »