What's the difference between “URIEncoding” of Tomcat, Encoding Filter and request.setCharacterEncoding

前端 未结 2 1991
生来不讨喜
生来不讨喜 2021-02-09 21:46

There may be many ways to solve encoding problem:

  • Encoding filter like Spring MVC UTF-8 Encoding

  • Setting URIEncoding=UTF-8 in server.xml of Tom

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-09 22:09

    for tomcat7

    • CharacterEncodingFilter configures encoding of request body. That is, it affects encoding of POST request parameters, etc, but doesn't affect encoding of GET parameters

    • useBodyEncodingForURI="true" tell tomcat to use CharacterEncoding( can be set by CharacterEncodingFilter) to parse QueryString. it's affect GET request parameter .

    • URIEncoding to parset URI , default is ISO-8859-1.

    for tomcat8

    • default UTF-8.

提交回复
热议问题