#32498 [Opn->Bgs]: starting with 5.x the XML extension returns data in different encoding
| From: | chregu@php.net | Date: | Wed, 30 Mar 2005 16:44:46 +0000 |
| Subject: | #32498 [Opn->Bgs]: starting with 5.x the XML extension returns data in different encoding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76067@lists.php.net to get a copy of this message | ||
ID: 32498
Updated by: chregu@php.net
Reported By: thies at thieso dot net
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: linux
PHP Version: 5CVS-2005-03-30 (dev)
New Comment:
This was discussed in
http://bugs.php.net/bug.php?id=29711
It was accepted as a BC-break-we-can-live-with, exactly because of "if
you pass the 'ISO-8859-1' to xml_parser_create the php5.x behavior is
like php4.x.", so you can at least "fix" the script easily to run on
both versions.
Previous Comments:
------------------------------------------------------------------------
[2005-03-30 11:05:39] thies at thieso dot net
Description:
------------
see code:
php 4.x will return the data in 'ISO8859-1'
php 5.x will return data in 'UTF8'
this will break every single script that uses non-UTF8 encoded
xml-files with the "old" xml extension (OK only if you use more than
"US-ASCII" characters in the xml).
this BC break happened when we switched from expat to libxml.
sidenote: as php does not support UTF8 natively i think it makes little
sense to make this the default return-encoding for any
internal-function.
btw: if you pass the 'ISO-8859-1' to xml_parser_create the php5.x
behavior is like php4.x.
Reproduce code:
---------------
<?php
$xml = '<?xml version="1.0"
encoding="ISO8859-1"?><a>����</a>';
xml_parse_into_struct(xml_parser_create(), $xml, $v, $i);
echo $v[0]['value'];
?>
Expected result:
----------------
(can't paste cause of encoding)
Actual result:
--------------
(can't paste cause of encoding)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32498&edit=1