|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-16 11:15 UTC] rrichards@php.net
[2006-02-16 13:16 UTC] chregu@php.net
[2006-02-16 14:00 UTC] memoimyself at yahoo dot com dot br
[2006-02-16 14:30 UTC] memoimyself at yahoo dot com dot br
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 05:00:01 2025 UTC |
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.