Byte UTF-8 sequence is not valid XML 3 bytes 3

Today, when writing in eclipse ** xml file, comments in Chinese is to identify the eclipse error: 3-byte UTF-8 byte sequence invalid 3, has repeatedly encountered the problem, the root of the problem is:

The cause of this is a file that is not UTF-8 is being parsed as UTF-8. It is likely that the parser is encountering a byte value in the range FE-FF. These values are invalid in the UTF-8 encoding. 

But this is very strange, I use notepad ++ code to save pom.xml "UTF-8 without BOM" form, encoding property is set in the pom.xml file as "UTF-8", the problem remains ah, depressed, do the above theory in question? Or eclipse bug in it? Read online for a long time, basically what they say.

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

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

Second, you can change in Eclipse, the eclipse of the menu [Project] → [Properties], click [Resources], to the right of the "Text file encoding", the original is the system default encoding, changed to "UTF -8"

However, considering the class can not change the encoded GB, so the encoding of xml attribute value UTF8 UTF8 to it

The actual operation time and found too many XML configuration file, it is impossible to change one by one, before a normal, so to give up such programs, the ultimate solution is to set spelling coding and coding workspace, and then re-import the items deleted, normal

If not enough, POM file compiled add coding


<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>

 

Guess you like

Origin www.cnblogs.com/remember-forget/p/11317045.html