php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33375 xml_parse return invalid character error with ISO-8859-1 data
Submitted: 2005-06-17 02:27 UTC Modified: 2005-06-17 10:59 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: frederic dot lecointre at burnweb dot net Assigned:
Status: Not a bug Package: XML related
PHP Version: 5CVS-2005-06-17 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: frederic dot lecointre at burnweb dot net
New email:
PHP Version: OS:

 

 [2005-06-17 02:27 UTC] frederic dot lecointre at burnweb dot net
Description:
------------
xml_parse return invalid character error with ISO-8859-1 data.

Reproduce code:
---------------
<?php
function startElement($parser, $name, $attribs){return true;}

function endElement($parser, $name){return true;}

$xml_string = '
<head>
	<title>Fr?d?ric</title>
</head>
';
$xml_parser = xml_parser_create('ISO-8859-1');
xml_set_element_handler($xml_parser, "startElement", "endElement");

if (!xml_parse($xml_parser, $xml_string, true)) {
    die(sprintf("error : %s at line %d col %d\n",
                xml_error_string(xml_get_error_code($xml_parser)),
                xml_get_current_line_number($xml_parser),
				xml_get_current_column_number($xml_parser)));
}
?>

Actual result:
--------------
error : Invalid character at line 3 col 20

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-17 10:20 UTC] sniper@php.net
This also causes the pear install fail in HEAD.
And this is because we now use libxml2 instead of expat where former is more strict perhaps?

 [2005-06-17 10:41 UTC] frederic dot lecointre at burnweb dot net
hi,

there's no more or less strict! ISO-8859-1 is ISO-8859-1 !
is there an active maintener for this extension ?
 [2005-06-17 10:42 UTC] chregu@php.net
You have to define the encoding of the XML document in the XML 
header (which is also the XML standard, if you don't do that, 
it defaults to UTF-8). The xml_parser_create() parameter is 
only for the output-encoding (since PHP 5). See the manual for 
details.

Can you please try adding 
<?xml version="1.0" encoding="ISO-8859-1"?>
to your XML document and see if it works?
 [2005-06-17 10:50 UTC] frederic dot lecointre at burnweb dot net
hi,
it's ok with prolog <?xml version="1.0" encoding="ISO-8859-1"?>

so bug closed and archived!

thanks
 [2005-06-17 10:59 UTC] derick@php.net
As there was no bug here-> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 15:01:30 2024 UTC