Causes and solutions:
https://bugs.java.com/bugdatabase/view_ bug.do?bug_ id=4163515
https://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding/362006#362006
Who sets file. Encoding
First, file. Encoding is a system property. It can be set before starting the JVM, such as:
java -Dfile.encoding=UTF-8 xxx.class
Another way is to change the system region of the operating system, because if this property is not set when the JVM starts, the encoding mode is selected according to the system region (locale) by default
When the region is China, the file.encoding is GBK region
When the region is the United States, the file.encoding is cp1252 region
In JDK1.8, only four references to file. Encoding are found
The default encoding method of JVM: charset. Defaultcharset ()
Function of sun.jnu.encoding: used to parse command line parameters, classes containing main methods, and environment variables
http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/
Similar Posts:
- [Solved] Java compilation error: unmapped character encoding GBK
- AWS S3 CLI – Could not connect to the endpoint URL
- How to Solve TestNG Frame Warning:Cannot find class in classpath: NewTest
- [Swift] an error occurs when passing parameters using alamofire
- Windows Android studio generates Javadoc
- Spring MVC: How to Solve Chinese garbled code Issue
- [Solved] Hibernate Error: org.hibernate.InstantiationException: No default constructor for entity
- [Solved] Error in Python selenium + phantom JS alert() pop-up window
- Springboot startup error yamlexception/malformedinputexception input length = 1
- UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1: