|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-21 08:17 UTC] derick@php.net
[2006-11-21 12:27 UTC] sotiwin at freemail dot hu
[2007-08-17 11:53 UTC] vrana@php.net
[2007-08-17 13:31 UTC] jani@php.net
[2007-08-17 16:19 UTC] vrana@php.net
[2007-08-17 17:49 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ I want to parse an xml, with accentuated letters, but the parser cuts the characters before the first accentuated letter of each 'characterData'. I use Wamp5 with php 5.1.6. Reproduce code: --------------- <meta http-equiv="Content-type" value="text/html; charset=ISO-8859-1" /> <?php function characterData($parser, $data) { echo $data.'1'; } $data='<?xml version="1.0" encoding="ISO-8859-1"?><book>Example??</book>'; echo 'XML input:<br>'.$data; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE,1); xml_set_character_data_handler($xml_parser,'characterData'); echo '<br>Parsed data:<br>'; if (!xml_parse($xml_parser, $data)) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } xml_parser_free($xml_parser); ?> Expected result: ---------------- characterData could have run only once. XML input: Example?? Parsed data: Example??1 Actual result: -------------- characterData could have runs twice. XML input: Example?? Parsed data: Example1??1