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

From: Date: Sun, 19 Mar 2006 20:12:25 +0000
Subject: #36785 [Opn->Bgs]: 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-94568@lists.php.net to get a copy of this message
ID: 36785 Updated by: tony2001@php.net Reported By: giunta_gaetano at libero dot it -Status: Open +Status: Bogus Bug Type: XML related Operating System: windows 2000 PHP Version: 5.1.2 New Comment: The cause and the solution is properly explained in bug #33375. NO bug here. Previous Comments: ------------------------------------------------------------------------ [2006-03-19 00:21:27] giunta_gaetano at libero dot it Description: ------------ PLEASE REOPEN AND FIX BUG #33375! It bewilders me that this has not yet been fixed in php 5.2.1... It is a BC breakage against PHP 4, and makes very very little sense anyway: - xml does NOT mandate a charset specification in the prologue - other communication/storage layers impose DIFFERENT standards on charset declarations and default charset values that the xml spec does by itself to be more clear, a common example: - received xml message has no charset in the prologue - it is received over HTTP, and the http content-type header states a charset (it is authoritative, according to the specs) - there is no way to tell the xml parser to use the correct charset for parsing the message! Why on earth was it not decided, when switching to libxml, that xml_parser_create() would get some automagic new powers, while xml_parser_create('ISO-8859-1') would be 100% backwards compatible and let the coder specify a source charset??? PS: at least fix the manual, and clearly specify that in order for the 'magical charset detection' to work, the xml prologue MUST contain a charset declaration!!! PPS: last but not least: the column number where the error is found (xml_get_current_column_number()) is also borked: whereas with php 4 the error reported the column corresponding to the first non-ascii char found, with php 5 the error reports the column where the xml element closing tag starts, which is a bit misleading... Reproduce code: --------------- Just try to parse any ISO-8859-1 xml file that has no charset specified in the prologue. Expected result: ---------------- no error Actual result: -------------- a dumb parsing error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36785&edit=1

« previous php.bugs (#94568) next »