SimpleXML parsing error for PHP5

Source: Internet
Author: User

The previous array uses SimpleXML to parse an RSS data source, and it's easy to get the results you want. Don't want to start an error in a few days:

Warning:simplexml_load_file () [Function.simplexml-load-file]: Input conversion failed due to input error, bytes 0xAD 0xb5 0x3c 0x2f

The first guess was a bug in php5, but the search found that it was possible that the RSS feeds were mixed with other encoded characters, resulting in simplexml parsing errors.

In other words, if the RSS declaration is this way:

PLAIN textxml: <?xml version= "1.0" encoding= "GB2312"?>

Then the RSS content must be gb2312.

Solutions

Converting code with ICONV

Modify encoding to the correct encoding

Related Article

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.