Tomcat Chinese garbled solution effective pro-test []

Copyright: please leave a message like Give me praise problematic -------------------------------- will be updated from time to time , because learning, so happy, because the share, so convenient! Reprint please indicate the source, ha ha! https://blog.csdn.net/Appleyk/article/details/84822925

 

Scene One: SpringBoot project, started in IDEA, the access interface, no garbled

 

 

 

 

 

 

Scene Two: SpringBoot project, labeled as war package, sent to the next local tomcat, start the access interface, garbled

 

 

 

 

 

problem analysis:

 

1, since the results of the query are displayed in normal IDEA, it shows the data stored in the database in the OK (encoding the problem does not exist)

 

Database: couchdb

 

 

 

 

2, will be SpringBoot profile is not configured coding it?

 

application.properties:

 

spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true 
spring.http.encoding.force=true 

 

Verification found not SpringBoot project configuration problems

 

 

3, will not be a problem tomacat it?

 

Since the start no problem in the IDEA, a description SpringBoot (execution itself embedded tomcat web container) is not a suspect, why would run on the local tomcat under Chinese distortion of it?

 

Configuring tomcat coding

 

server.xml

 

  <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="600000"
			   maxThreads="150"            
               redirectPort="8444" maxPostSize="0" URIEncoding="UTF-8" />

 

Tried, with this little egg, perhaps my tomcat relatively stubborn temper it, there followed a similar configuration, but also with no eggs

 

   <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="600000"
			   maxThreads="150"            
               redirectPort="8444" maxPostSize="0" useBodyEncodingForURI="true" />

 

 

4, anyway, certainly tomcat is a problem, you are responsible for running my program, a problem, not looking you looking for?

 

solution:

 

Modify bin / catalina.bat, add a line configuration

 

set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MaxPermSize=1024m -Dfile.encoding=UTF-8

 

 

 

 

Finally, to solve the garbage problem:

 

 

 

Note: This method is suitable to change the linux system, if used under Windows, then Chinese console output is garbled when tomcat starts, as follows

 

 

 

Best of both worlds, your own search solution!

Guess you like

Origin blog.csdn.net/Appleyk/article/details/84822925