I have been using Tomcat for a long time, but I still have little knowledge about it. This is because of the limited understanding that many problems have occurred in the system development process. Today I will summarize the Chinese Garbled text problem that I encountered for Tomcat, the default encoding used during data transmission is ISO8859_1.
UseMcAt has been around for a long time, but his understanding of it is still very limited.
This is because of the limited understanding that many problems have occurred in the system development process. Today I will summarize the Chinese garbled characters I have encountered.
For TomCatThe default encoding used during data transmission is ISO8859_1. If our pages and back-end databases adopt the ISO8859_1 encoding in a unified manner, no problem will occur.
However, sometimes we have some special requirements. We need to encode the page and database into GBK or something else. This will cause some data problems.
For a page form, there are two ways to pass values: one is POST and the other is GET.
If you want to set the GET value encoding method, you need to add urie in the conf/server. xml Connector (which corresponds to your port ).NcOding = "GBK" attribute
If you want to set the POST method, you need to write a filter to specify the request.SetCharacterEncoding ("GBK ")
The above are basic settings. Sometimes we use some open-source frameworks, so we need to have a comprehensive understanding of the open-source frameworks, especially the configuration files, if the configuration is incorrect, you may encounter some problems that you may find inexplicable:
STrThe encoding method can also be set in the configuration file of uts2.0. Its function is the same as that of the filter.