#44297 [Opn->Bgs]: XSLTProcessor::transformToXML doesn't change content-type's charset
ID: 44297
Updated by: chregu@php.net
Reported By: jaap dot taal at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: XSLT related
Operating System: Windows
PHP Version: 5.2.5
New Comment:
It's not the XSLT extension, which sends the COntent-Type header. It's
-
at the end - apache, so if you don't tell apache (via php), which
content type it should use, it takes the default one.. And that is
obviously different from what you expect :)
Previous Comments:
------------------------------------------------------------------------
[2008-02-29 22:28:33] jaap dot taal at gmail dot com
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 this bug report at http://bugs.php.net/?id=44297&edit=1
Thread (2 messages)