Error message
Invalid byte 1 of 1-byte UTF-8 sequence
Cause analysis
In the Chinese version of the window, the default encoding of java is GBK, that is, although we have marked the xml is saved in utf-8 format but in fact the file is saved in GBK format, so this is why we can use GBK and GB2312 encoding to generate xml files that can be parsed correctly, while files generated in UTF-8 format The reason why it cannot be parsed by the xml parser.
Change the encoding attribute value of xml from UTF-8 to UTF8
org.xml.sax.SAXParseException: Content is not allowed in trailing section
It can be solved by parsing and trim() the string first question.
Solution:
1. The simplest is to change to
2. Or change the character set to UTF-8 when opening the xml and save it
or change the program