Tag Archives: Chinese garbled code Issue

Spring MVC: How to Solve Chinese garbled code Issue

The parameters of spring MVC receiving get requests are not necessarily garbled

tomcat 8.xx Before the encoding default is iso After the encoding default is utf-8

Spring MVC receives post requests without coding rules, so it will be garbled

    web.xml   add CharacterEncodingFilter

      <filter>
        <filter-name>charset</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
          <param-name>encoding</param-name>
          <param-value>UTF-8</param-value>
        </init-param>
      </filter>
      <filter-mapping>
        <filter-name>charset</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>