#33375 [Fbk->Opn]: xml_parse return invalid character error with ISO-8859-1 data

From: Date: Fri, 17 Jun 2005 08:50:41 +0000
Subject: #33375 [Fbk->Opn]: xml_parse return invalid character error with ISO-8859-1 data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-80521@lists.php.net to get a copy of this message
ID: 33375 User updated by: frederic dot lecointre at burnweb dot net Reported By: frederic dot lecointre at burnweb dot net -Status: Feedback +Status: Open Bug Type: XML related Operating System: * PHP Version: 5CVS-2005-06-17 New Comment: hi, it's ok with prolog <?xml version="1.0" encoding="ISO-8859-1"?> so bug closed and archived! thanks Previous Comments: ------------------------------------------------------------------------ [2005-06-17 10:42:05] 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:41:22] 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:20:52] 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 02:27:09] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33375&edit=1

« previous php.bugs (#80521) next »