1. Garbled console
This is because the default encoding of windows’s CMD is GBK, while Tomcat is UTF-8. Of course, there will be garbled codes. But for this garbled code, we just need to make the encoding format printed on the console GBK.
Modify the logging.properties configuration
and add it in the logging.properties configuration file under conf
java.util.logging.ConsoleHandler.encoding = GBK
Restart Tomcat to see that the console output log is normal
2. HTML page garbled
Modifying the web.xml file in Tomcat
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>fileEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
I’ve also read many articles about modifying server.xml and catalina.bat, but they didn’t work for me. I tried to restore all Tomcat configurations, only modifying web.xml here, and finally determined that I only need to modify here
If you don’t succeed according to me, try to modify others!
Read More:
- Idea starts Tomcat console with garbled code but no error
- Solve the problem of using logback console to print log Chinese characters in IDEA as garbled characters
- Solve the problem of error running console reported by pycharm Python console
- Solution to the problem of Chinese garbled in gradle console in idea
- Solve the problem of visual studio console flashback
- Solve the problem of vscode window console “flash”
- Solve the problem of Chinese garbled code of actibpm plug-in in idea
- Solve the problem that data cannot be input in idea console
- Solve the problem of garbled code when Python connects to ADB
- To solve the problem of failed to load: data in HTML5 game running rmmv locally/ actors.json problem
- How to solve the problem of string to CString garbled code?
- When MyEclipse starts tomcat, the console doesn’t jump out
- How to solve the problem that the console window disappears in a flash after visual studio 2017 runs
- Solve the problem of “error empty block statement no empty” in the console (Vue project)
- Solution to garbled code problem after importing project in eclipse
- Resttemplate Chinese garbled problem – available
- Solution of MySQL data garbled problem
- The garbled problem of hot deployment in nginx
- After Oracle 11g is installed, SQL_ Plus.exe The problem of Chinese garbled in command window
- Solving the problem of Chinese garbled code in qtring