note 14728 deleted from function.xml-parse-into-struct by sniper
| From: | sniper@php.net | Date: | Fri, 05 Dec 2003 00:32:28 +0000 |
| Subject: | note 14728 deleted from function.xml-parse-into-struct by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61425@lists.php.net to get a copy of this message | ||
Note Submitter: php@nichtich.de
----
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