|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44297 XSLTProcessor::transformToXML doesn't change content-type's charset
Submitted: 2008-02-29 22:28 UTC Modified: 2008-03-01 08:53 UTC
From: jaap dot taal at gmail dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 5.2.5 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jaap dot taal at gmail dot com
New email:
PHP Version: OS:


 [2008-02-29 22:28 UTC] jaap dot taal at gmail dot com
When I execute the code on linux the dash (&#8211) 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:

Reproduce code:
$xml = "<mytag>&amp;#8211 is a dash: &quot;&#8211;&quot;</mytag>";
$xmldoc = new DOMDocument();
$xsl = '<stylesheet xmlns="" version="1.0"/>';
$xsldoc = new DOMDocument();
$proc = new XSLTProcessor();
echo $proc->transformToXML($xmldoc);

Expected result:
&#8211 is a dash: "?"

Actual result:
&#8211 is a dash: "–"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-01 08:53 UTC]
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 :)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Apr 17 09:01:24 2021 UTC