#37544 [Opn->Bgs]: Breaks national encoding
ID: 37544
Updated by: derick@php.net
Reported By: php at juzna dot com
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: WinXP
PHP Version: 5.1.4
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Not a bug, as the XML parser always outputs UTF8. Use "iconv" to
convert it back into the encoding that you want.
Previous Comments:
------------------------------------------------------------------------
[2006-05-21 16:27:59] php at juzna dot com
Description:
------------
XML parsing breaks some national encoding, however there shouldn't be
any problem width it.
Reproduce code:
---------------
$xml = file_get_contents('http://xml.vht.cz/demo.xml');
$xml_parser = xml_parser_create();
xml_set_character_data_handler($xml_parser, "characterData");
xml_parse($xml_parser,$xml,true);
xml_parser_free($xml_parser);
function characterData($parser, $data) {
$data = trim($data);
if($data) var_dump($data);
}
Expected result:
----------------
Expexted original data with original encoding (like this):
Sutomore - hotel Zlatna obala
Jiøí Buèek - CK VHT
Hotelový komplex Zlatna Obala je umístìn ve vzdálenosti cca 500 m od
Sutomore. Má vlastní plá v prostøedí piniového háje.<br>
Actual result:
--------------
Broken encoding (absolutely wrong characters)
string(29) "Sutomore - hotel Zlatna obala"
string(2) "Ji"
string(20) "ÅÃ BuÄek - CK VHT"
string(7) "Hotelov"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37544&edit=1
Thread (2 messages)