Request string encoding for "Tomcat" Tomcat configuration

Source: Internet
Author: User

By default, if the WebService or Web site that is deployed in Tomcat needs to have Chinese request parameters, and when we enter Chinese directly in the browser then the acceptance will be garbled, unable to meet our needs, At this point we need to set up the encoding format for Tomcat's request link.

Under Tomcat there is a conf directory with a server.xml configuration file, which has the following configuration for each port:
<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>
We need to add uriencoding= "UTF-8" at the end of this configuration, that is, the final form is:
<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443"
uriencoding= "UTF-8"/>

Note: This line must be added to the last side, otherwise invalid, I personally tried, before adding to the third row results alive or not, very strange, and later debugging for a long time to find out this ghost is out in this order.
This configuration is only valid for a get type of request and is not valid for a POST request. The parameter encoding for the POST request is still "iso8859-1", not "UTF-8"

Request string encoding for "Tomcat" Tomcat configuration

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.