Solution to the invalid problem of character encoding filter based on tomcat8

When colleagues encounter coding problems, they want to make a character coding filter to solve the whole station. The filter class and configuration are as follows:

Filter class:

Filter configuration:

However, when the submission method of the front-end form is get, the result is still garbled.

At the beginning, I was obsessed with whether the filter was wrong and whether the code set was wrong, but after testing, there was no error and the filter operated normally,

Finally, put value Getbyte ("iso-8859-1", "UTF-8") is changed to value Getbyte ("UTF-8", "UTF-8") can get the value in the background, which is no longer garbled. Finally, Baidu,

The default encoding set of tomcat8 is UTF-8, and the default encoding set before tomcat8 is iso-8859-1. I suddenly realized

Summary: the default encoding set before tomcat7 and its version is iso-8859-1, and the default character set of tomcat8 is UTF-8, so it is no longer required to be request The result of getparameter () is transcoded, and there is no need to encode the filter class

The above solution to the invalid problem of character coding filter based on tomcat8 is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>