php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12707 xml_parse_into_struct ignores XML_OPTION_TARGET_ENCODING
Submitted: 2001-08-12 10:57 UTC Modified: 2001-08-12 14:37 UTC
From: php at nichtich dot de Assigned:
Status: Closed Package: XML related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at nichtich dot de
New email:
PHP Version: OS:

 

 [2001-08-12 10:57 UTC] php at nichtich dot de
xml_parse_into_struct does not seem to encode the name of tags in UTF-8 ignoring the XML_OPTION_TARGET_ENCODING you specified with xml_parser_set_option.

You reproduce the problem (using ISO-8859-1) with the
following script: 

<?
  $xmldata = "<?xml version='1.0' encoding='ISO-8859-1'?><???>???</???>";

  $parser = xml_parser_create('ISO-8859-1');

  // i want ISO-8859-1 !!
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING,"ISO-8859-1");

  xml_parse_into_struct($parser, $xmldata, $struct, $index);

  // need do decode tag names manually like this :-(
  //  foreach (array_keys($struct) as $index)
  //    $struct[$index]['tag']= utf8_decode(&$struct[$index]['tag']);

  // the name '???' is not encoded correctly
  echo "<h1>Struct</h1><pre>"; print_r($struct); echo "</pre>";
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-12 14:37 UTC] thies@php.net
fixed in CVS

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 14:03:13 2021 UTC