#44297 [NEW]: XSLTProcessor::transformToXML doesn't change content-type's charset
From: jaap dot taal at gmail dot com
Operating system: Windows
PHP version: 5.2.5
PHP Bug Type: XSLT related
Bug description: XSLTProcessor::transformToXML doesn't change content-type's charset
Description:
------------
When I execute the code on linux the dash (–) is shown as a dash.
This is because PHP adds a "Content-Type: text/html; charset=UTF-8" header
(used firebug to view the info).
On my windows installation, however, the header isn't modified so my
browser is displaying "â" instead of a dash.
Manually adding the header works, but it's only a workaround.
I've found a similar bugreport from two years:
http://bugs.php.net/bug.php?id=36415
Reproduce code:
---------------
<?php
$xml = "<mytag>&#8211 is a dash:
"–"</mytag>";
$xmldoc = new DOMDocument();
$xmldoc->loadXML($xml);
$xsl = '<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"
version="1.0"/>';
$xsldoc = new DOMDocument();
$xsldoc->loadXML($xsl);
$proc = new XSLTProcessor();
$proc->importStylesheet($xsldoc);
echo $proc->transformToXML($xmldoc);
?>
Expected result:
----------------
– is a dash: ""
Actual result:
--------------
– is a dash: "â"
--
Edit bug report at http://bugs.php.net/?id=44297&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44297&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44297&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44297&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44297&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44297&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44297&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44297&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44297&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44297&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44297&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44297&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44297&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44297&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44297&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44297&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44297&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44297&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44297&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44297&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44297&r=mysqlcfg
Thread (2 messages)
- jaap dot taal at gmail dot com