php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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:
http://bugs.php.net/bug.php?id=36415

Reproduce code:
---------------
<?php
$xml = "<mytag>&amp;#8211 is a dash: &quot;&#8211;&quot;</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:
----------------
&#8211 is a dash: "?"

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-01 08:53 UTC] chregu@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 13:01:31 2024 UTC