The Chinese garbled problem of get and post in the form

Source: Internet
Author: User

In a project written with struts, the foreground has a hyperlink that sends the request to the background and passes the value of the variable containing the Chinese. The result was a mistake. However, this value is not a problem when it is delivered in a form by post.

The parameters of a hyperlink are passed in a get way, and it is not the same way to find the delivery on the web.

The general understanding is that the post method is encoded in the encoded format specified in the page, and the Get method needs to be passed by URL, so it is coded differently.

Therefore, the variables passed by the Get mode are best received in the form of a new String (Xxx.getbytes ("iso-8859-1"), "Utf-8".

Some people say that you can modify the encoding of the filter in Tomcat, but do not arbitrarily modify the good, can be modified at the lowest cost the best.

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.