note 14728 added to function.xml-parse-into-struct.php
| From: | php at nichtich dot de | Date: | Sun, 12 Aug 2001 14:44:12 +0000 |
| Subject: | note 14728 added to function.xml-parse-into-struct.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16598@lists.php.net to get a copy of this message | ||
xml_parse_into_struct encodes the name of tags in UTF-8 ignoring the XML_OPTION_TARGET_ENCODING you
specified with xml_parser_set_option.
To parse ISO-8859-1 encoded XML use:
$parser = xml_parser_create('ISO-8859-1');
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING,"ISO-8859-1");
xml_parse_into_struct($parser, $xmldata, $struct, $index);
// decode tag names back to ISO-8859-1
foreach (array_keys($struct) as $index)
$struct[$index]['tag'] = utf8_decode($struct[$index]['tag']);
simple but annoying.
Jakob
http://www.php.net/manual/en/function.xml-parse-into-struct.php