1. The catalina.bat must be set to UTF-8. If I don't set it to UTF-8, the page receives garbled characters. I have tried various UTF-8 debugging methods, but to no avail. Finally, I can only set "JAVA_OPTS=%JAVA_OPTS% %JSSE_OPTS% -Dfile.encoding=UTF-8" in catalina.bat. Adding UTF-8 can solve the problem, but the command box and output log of tomcat are all garbled characters . 2. If you are using a compilation tool, you can solve the problem by setting -Dfile.encoding=UTF-8 in the VM options of the IDEA compiler, or by changing it to utf-8 in the eclipse settings. However, when deploying with Tomcat on a Windows server, the garbled characters cannot be solved. 3. Adding UTF-8 to service.xml is useless, and garbled characters are still displayed. <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8433" URIEncoding="UTF-8" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8433" URIEncoding="UTF-8"/> Cause of the problem:The default encoding set of Windows is GBK. When you use startup.bat to start Tomcat, it will read the code of catalina.bat and open a new window to run. The default encoding of the opened cmd may not be utf-8, which is inconsistent with the system encoding, resulting in garbled characters. Solution:Modify the encoding of the cmd command line, open the registry, find HKEY_CURRENT_USER→Console→Tomcat (if you changed the title bar of tomcat, this is the name of the command window you opened), find the CodePage item, create it if it does not exist, change the value to decimal 65001, and click OK. This is the end of this article about the garbled characters appearing in the console when catalina.bat is set to UTF-8 in Tomcat. For more information about setting catalina.bat to UTF-8 in Tomcat, 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:
|
<<: Analysis and solution of flex layout collapse caused by Chrome 73
>>: Detailed explanation of the usage of 5 different values of CSS position
Table of contents 1. Parent components and child ...
Table of contents 1. Create objects by literal va...
Software Download Download software link: https:/...
Yum (full name Yellow dog Updater, Modified) is a...
nginx (engine x) is a high-performance HTTP and r...
Table of contents Preface Introduction ngram full...
Table of contents 1. child_process 2. Command exe...
Table of contents 1. Introduction 2. MVCC (Multi-...
Encryption and decryption are an important means ...
How to center your HTML button itself? This is ea...
This article shares the specific code of jQuery t...
XHTML is the basis of CSS layout. jb51.net has al...
Table of contents Basic syntax for multi-table jo...
Preface As a heavy user of front-end frameworks, ...
Many friends who have just started to make web pag...