Article Directory
Problem scenario
maven
After compiling the package, run error, suggesting Invalid byte 3 of 3-byte UTF-8 sequence.
that: . Checking the specific file that reported the error, it was found that it was a XML
file, and the encoding was UTF-8
, but there were some Chinese garbled characters in the packaged file . This blog post is mainly about the solution to this situation.
Problem environment
software | version |
---|---|
JDK | 1.8 |
maven | 3 |
problem causes
At present, it is suspected that the file has undergone multiple conversions, causing some Chinese characters in the file to be garbled.
solution
The following configuration is added to the pom.xml file, and the encoding of the specified resource file is unified as UTF-8
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
result
The problem was resolved smoothly.
to sum up
During the development process, various problems will always be encountered. Be careful and check carefully.
Ask for praise
If my article is helpful to everyone, you can click like or favorite at the bottom of the article;
if there is a good discussion, you can leave a message;
if you want to continue to view my future articles, you can click Follow
You can scan the following QR code to follow me 'S public account: Fengye Zhixuege, check out my latest share!