Bug #60142 [NEW]: XSLTProcessor::transformToXML does not output UTF-8
| From: | maximeraoust at gmail dot com | Date: | Wed, 26 Oct 2011 16:11:10 +0000 |
| Subject: | Bug #60142 [NEW]: XSLTProcessor::transformToXML does not output UTF-8 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-164586@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows
PHP version: 5.3.8
Package: XSLT related
Bug Type: Bug
Bug description:XSLTProcessor::transformToXML does not output UTF-8
Description:
------------
XSLTProcessor::transformToXML never seem to output UTF-8 data.
Bug was already reported (https://bugs.php.net/bug.php?id=36415 &
https://bugs.php.net/bug.php?id=36407&edit=2)
but not enough information
were
provided and reports were closed. So here's attached a complete test.
I'm running PHP 5.3.8 VC9 + Apache 2.2.21 VC9 on Windows 7 Professional
SP1.
I also tested on 5.3.2 under Ubuntu 10.04.3 and it works fine.
Test script:
---------------
<?php
$xslt = '<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:output
method="text" /></xsl:stylesheet>';
$inputText = 'UTF-8 text with accents: éèà ç';
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->loadHTML($inputText);
$xsl = new DOMDocument('1.0', 'UTF-8');
$xsl->loadXML($xslt);
$proc = new XSLTProcessor();
$proc->importStylesheet($xsl);
echo $proc->transformToDoc($doc)->saveXML();
?>
Expected result:
----------------
It should output (in CLI):
<?xml version="1.0"?>
UTF-8 text with accents: éèàç
Or if displayed in browser:
UTF-8 text with accents: éèà ç
Actual result:
--------------
It outputs:
<?xml version="1.0"?>
UTF-8 text with accents:
éèàç
Or if displayed in browser:
UTF-8 text with accents: éèà ç
--
Edit bug report at https://bugs.php.net/bug.php?id=60142&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60142&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60142&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60142&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=60142&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60142&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=60142&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=60142&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=60142&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=60142&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=60142&r=support
Expected behavior: https://bugs.php.net/fix.php?id=60142&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=60142&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=60142&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=60142&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60142&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60142&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=60142&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=60142&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=60142&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=60142&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=60142&r=mysqlcfg