It’s not just a matter of post编码,而是characterEncoding只对body有效。 http有很多method比如像put方法也是有body的。 即使你使用post如果url中存在中文query parameters一样需要针对urlsetting the encoding.
1. Because few people use the GET method to transmit Chinese content. As for why the filter only solves the problem of Chinese transmission garbled characters in the POST method, I think it is not a technical problem. It may be intentional by the designer, hoping to guide us to use the POST method more. It's like requiring a large truck to carry a lot of people like a passenger car. For the person who designs the large truck, he won't take this situation into consideration.
2. The problem of transmitting Chinese garbled characters in the GET method is not unsolvable. The solution is also very simple, but it is not recommended because this method is not universal for the POST method. The sample code is as follows:
It’s not just a matter of
post
编码,而是characterEncoding
只对body
有效。http有很多
method
比如像put
方法也是有body
的。即使你使用
post
如果url
中存在中文query parameters
一样需要针对url
setting the encoding.1. Because few people use the GET method to transmit Chinese content. As for why the filter only solves the problem of Chinese transmission garbled characters in the POST method, I think it is not a technical problem. It may be intentional by the designer, hoping to guide us to use the POST method more. It's like requiring a large truck to carry a lot of people like a passenger car. For the person who designs the large truck, he won't take this situation into consideration.
2. The problem of transmitting Chinese garbled characters in the GET method is not unsolvable. The solution is also very simple, but it is not recommended because this method is not universal for the POST method. The sample code is as follows: