Solve the problem of Tomcat console and HTML garbled

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 configuration
and add it in the 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


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: