tomcat pages garbled

 

First, garbled output page

 

There are three possible

 

1.server.xml configuration did not specify the encoding format

 

The browser itself has its own display encoding format, tomcat output also has its own format, even we can also specify the output encoding in the process of writing code. So this kind of garbled reasons, we need to maintain the unity of various encoding formats:

 

a. We added to the configuration of the port in the server.xml tomcat URIEncoding = "UTF-8"

 

 

b. In the html <html> </ html> tag in the tag plus meta

 

 

c. The best time of an output page specified in programming encoded as UTF-8

 

2.catalina.bat configuration issues

 

Plus \ tomcat \ bin \ catalina.bat this profile

 

set JAVA_OPTS=-Dfile.encoding=UTF-8

 

3. compilation tools, VM options in the compiler IDEA: Set -Dfile.encoding = UTF-8, setting change, or the eclipse utf-8 problems can be solved output

 

II. Garbled console output

 

The reason for this is set to windows default encoding GBK, due to start tomcat startup.bat use, it reads catalina.bat code and open a new window to run. Open cmd default encoding may not utf-8, is inconsistent with the system encoding, resulting in garbled. So the command box and tomcat logs are garbled output

 

The solution is twofold:

 

1. Modify coding cmd command line

 

a. Open the Registry, find HKEY_CURRENT_USER → Console → Tomcat

 

b. Locate CodePage items, not create, change the decimal value of 65001

 

2. Modify configuration logging.properties

 

a.打开tomcat/conf/logging.properties

 

. B add the statement:

 

java.util.logging.ConsoleHandler.encoding = GBK

 

c. Restart tomcat, you can view the log data

Source: https://cloud.tencent.com/developer/article/1441354

Guess you like

Origin www.cnblogs.com/liyunchuan/p/11541481.html