"100 Points" xml_parse_into_struct function parsing xml, Chinese garbled

Source: Internet
Author: User
"100 points for help" xml_parse_into_struct function parsing xml, Chinese garbled
The test code is as follows:

$xmldata = ' Chinese ';
$parser = xml_parser_create (' UTF-8 ');
$vals = Array ();

Xml_parse_into_struct ($parser, $xmldata, $vals);
Xml_parser_free ($parser);

Print_r ($vals);


PHP version is 5.4.20

In the conversion result, the Chinese part is garbled.

Ask everyone, there is no one who has encountered this problem, how to solve ... Thank you!
------Solution--------------------
Obviously your program file when the GBK
$xmldata = ' Chinese ';
$xmldata = Iconv (' GBK ', ' utf-8 ', $xmldata);


------Solution--------------------
In fact, you iconv transcoding is also possible
But my side of the show is normal, no garbled estimate is the wrong browser encoding
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.