In tomcat, jsp is not garbled, but html Chinese is garbled There are several reasons:The page encoding is not set. The configuration of Tomcat is incorrect. The encoding format of the saved file is not utf-8. Let's discuss the solution below. The html page is set to utf-8 and the tomcat server.xml configuration(1) Add URIEncoding="UTF-8" <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> (2) <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/> Set catalina.bat in tomcat (jvm encoding) In catalina.bat, add below set "JAVA_OPTS=%JAVA_OPTS% %JSSE_OPTS%" -Dfile.encoding=UTF8 -Dsun.jnu.encoding=UTF8 Set tomcat's web.xml (mine is around line 108) to the following:<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> The above is the solution to solve the garbled code of Tomcat . You need to restart Tomcat after configuration. Restart tomcat: If your toamcat is already started: enter the tomcat installation directory in the command line This is the end of this article on the ultimate solution to the Chinese garbled problem in tomcat static pages (html). For more relevant content on the Chinese garbled problem in tomcat static pages, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Button is stretched on both sides in IE
>>: CSS implementation code for drawing triangles (border method)
When I was at work today, the business side asked...
This blog post is about a difficulty encountered ...
This article example shares the specific code of ...
1. parseFloat() function Make a simple calculator...
1. Cleaning before installation rpm -qa | grep jd...
Scenario: A laradock development environment (php...
Table of contents 1. Purpose 2. Grammar 3. Practi...
This article introduces a framework made by Frame...
Usually the pictures uploaded by users need to be...
mysqlslap Common parameter description –auto-gene...
This article example shares the specific code of ...
The installation tutorial of mysql 5.7.19 winx64 ...
The difference between := and = = Only when setti...
Here are 10 HTML tags that are underused or misun...
1. Add an empty element of the same type, and the...