PHP solution XML hint Invalid byte 1 of 1-byte UTF-8 sequence

Source: Internet
Author: User


Invalid byte 1 of 1-byte UTF-8 sequence

Change the encoding attribute value of the XML UTF-8 to UTF8

Org.xml.sax.SAXParseException:Content is isn't allowed in trailing

You can solve the problem by first parsing and string trim ().

If it's gb2312, we'll just have a simple piece.

XML content is actually encoded in UTF-8, so that the XML file including Chinese characters can not be read properly, the encoding format is changed to "GB2312" after the normal parsing. <?xml version= "1.0" encoding= "GB2312"?>

Modify encoding


First, you can change the UTF-8 to GBK or GB2312 directly in the XML file

The code is as follows Copy Code

<?xml version= "1.0" encoding= "GB2312"?>


Second, you can change in eclipse, in Eclipse's feature sheet [project]→[properties],?? [Resources], in the right "text file encoding", put the original Xing to the y?? ??, change? "utf-8".

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.