ID: 27858 Updated by: [EMAIL PROTECTED] Reported By: selecter at spray dot se -Status: Open +Status: Bogus Bug Type: SimpleXML related Operating System: linux gentoo PHP Version: 5.0.0RC1 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. Thank you for your interest in PHP. Like any other XML parser simplexml interprets the XML entities to normal characters in UTF-8. Previous Comments: ------------------------------------------------------------------------ [2004-04-04 04:12:34] selecter at spray dot se Description: ------------ Character coding mess... index.php and example.xml are saved in koi8-r encoding Reproduce code: --------------- index.php: <?php include 'example.xml'; $xml = simplexml_load_string($xmlstr); function open_linkset($num) { global $xml; eval("foreach(\$xml->linkset[$num]->mylink as \$mylink) { generate_link(\$mylink->title, \$mylink->href); }"); } function generate_link($title, $href) { global $link; $link[]='<a href="?'.$href.'&open='.$_GET[open].'">'.$title.'</a>'; } function generate_linkbox() { global $xml, $link; $i=0; $array_size=sizeof($xml->linkset); foreach($xml->linkset as $mylinkset) { echo '<a href="?open='.$i.'">'.$mylinkset->name.'</a>'; echo "<br>"; if(isset($link) && $_GET[open]==$i) { $k=0; $link_array_size=sizeof($link); foreach($link as $mylink) { echo " ".$link[$k]; if($link_array_size<>$k)echo "<br>"; $k++; } } $i++; } } if(isset($_GET[open])) { open_linkset($_GET[open]); generate_linkbox(); }else{ generate_linkbox(); } ?> example.xml: <?php $xmlstr = <<<XML <?xml version='1.0' encoding='koi8-r' standalone='yes'?> <linkbox> <linkset> <name>Главная</name> <mylink> <href>to=fotos</href> <title>Fotos</title> </mylink> <mylink> <href>to=art</href> <title>Art</title> </mylink> </linkset> <linkset> <name>Discussion</name> <mylink> <href>to=forum</href> <title>Forum</title> </mylink> <mylink> <href>to=guestbook</href> <title>Guestbook</title> </mylink> </linkset> </linkbox> XML; ?> Expected result: ---------------- Executing index.php I expect to see 2 linksets: Главная Discussion Actual result: -------------- The actual result after executing index.php: Главная Discussion ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27858&edit=1
