php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32498 starting with 5.x the XML extension returns data in different encoding
Submitted: 2005-03-30 11:05 UTC Modified: 2005-03-30 18:44 UTC
From: thies at thieso dot net Assigned:
Status: Not a bug Package: XML related
PHP Version: 5CVS-2005-03-30 (dev) OS: linux
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thies at thieso dot net
New email:
PHP Version: OS:

 

 [2005-03-30 11:05 UTC] 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-30 18:44 UTC] chregu@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC