#44297 [NEW]: XSLTProcessor::transformToXML doesn't change content-type's charset

From: Date: Fri, 29 Feb 2008 22:28:33 +0000
Subject: #44297 [NEW]: XSLTProcessor::transformToXML doesn't change content-type's charset
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122811@lists.php.net to get a copy of this message
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 (&#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: "–"

-- 
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)

« previous php.bugs (#122811) next »