How to modify the jvm coded Tomcat runtime
issues:
data garbled recent developments in the deployment project, after some view items are used in UTF-8 encoding format, the data is, but after a call interface to pass each other on the hash.
Because it is deployed in a Windows environment, Windows default encoding GBK, which led to the jvm runtime inconsistent coding problem, modify it easily.
Solution:
Under Linux If you are using UTF-8 encoding, can not be modified because Linux defaults to UTF-8
war package deployed in Tomcat
Modify jvm coding
Linux environment
In the configuration catalina.sh
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=utf-8"
Since the default encoding format for the Windows environment GBK, so to modify Tomcat runtime encoding format.
Windows environment
In catalina.bat configuration
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8
If the jar package is deployed, just in order to start adding jvm parameters.
jar package deployment
Start command added jvm parameters
java -Dfile.encoding=UTF-8 -jar xxx.jar