SPRINGMVC GET request Chinese data passed to server side garbled

Source: Internet
Author: User

1. Description of the problem:

By Getjson method, Chinese is garbled when it is passed to server side.

2. Workaround

By looking for data, many say configure Web. xml

<Filter>        <Filter-name>Springencodingfilter</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>        <Init-param>            <Param-name>Forceencoding</Param-name>            <Param-value>True</Param-value>        </Init-param>    </Filter>    <filter-mapping>        <Filter-name>Springencodingfilter</Filter-name>        <Url-pattern>/*</Url-pattern>    </filter-mapping>

But this does not solve the problem, continue to find the data found this configuration is for post requests, get request configuration needs to modify Tomcat's server.xml configuration

<port= "8080"  protocolconnectiontimeout= "20000 "  redirectport=" 8443 "/>

Revision changed to

<port= "8080"  protocolconnectiontimeout  Redirectport = "8443" Usebodyencodingforuri = "true" />

SPRINGMVC GET request Chinese data passed to server side garbled

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.