#24863 [Opn->Fbk]: Not all entity names recognised and some output glitches
| From: | sniper@php.net | Date: | Wed, 30 Jul 2003 07:10:10 +0000 |
| Subject: | #24863 [Opn->Fbk]: Not all entity names recognised and some output glitches | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45043@lists.php.net to get a copy of this message | ||
ID: 24863
Updated by: sniper@php.net
Reported By: php at Bothware dot com
-Status: Open
+Status: Feedback
Bug Type: XSLT related
Operating System: Linux & Windows
PHP Version: 4.3.2
New Comment:
Please provide a full example with all the necessary files.
Previous Comments:
------------------------------------------------------------------------
[2003-07-29 19:28:04] php at Bothware dot com
Description:
------------
XSLT_process throws errors when it encounters certain valid entity
names, for the data I use, a suitable workarround was to replace them
with enitity numbers within a certain range.
( this maybe a missing feature as opposed to a proper bug )
A definite bug does occur with the output though :
character sequences such as â are output instead of entities such as
’ --- this is really really annoying, and I have to post-process
the output because of it.
WORKARROUNDS :
Solution to input 'bug'
$entities = array(128 => '#8364', 130 => '#8218', 131 =>
'#402', 132 =>
'#8222', 133 => '#8230', 134 => '#8224', 135 =>
'#8225', 136 => '#710',
137 => '#8240', 138 => '#352', 139 => '#8249', 140 =>
'#338', 145 =>
'#8216', 146 => '#8217', 147 => '#8220', 148 =>
'#8221', 149 =>
'#8226', 150 => '#8211', 151 => '#8212', 152 =>
'#732', 153 => '#8482',
154 => '#353', 155 => '#8250', 156 => '#339', 159 =>
'#376'
then do a find & replace
Soltuion to output 'bug'
function correctXSLT( $s ) {
$r = str_replace('â', '’', $s);
$r = str_replace('â', '‘', $r);
$r = str_replace('â', '“', $r);
$r = str_replace('â', '”', $r);
$r = str_replace('â¦', '…', $r);
return $r;
}
Reproduce code:
---------------
$x = xslt_create();
$a['xml']='<?xml version="1.0" encoding="UTF-8"
?'.'><somedata>’
‘ “ ” …</somedata>';
$result = xslt_process($x, 'arg:/_xml', 'xslInstr.xsl', NULL, $a);
/* this is a very minimalised example -- the actual files I'm
processing are about 2mb each !! */
Expected result:
----------------
’
‘
“
”
…
Actual result:
--------------
â
â
â
â
â¦
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24863&edit=1