Type of request method garbled processing method

Source: Internet
Author: User

1.GET requests the specified resource (the request data is added after the request resource path, so only a small amount of data can be submitted to the Web server)

2.POST submits the data to be processed to the specified resource (submits the data that needs to be processed to the server, which is written in the content of the request, which can result in the generation of new resources and updates of existing resources; What happens when the browser sends a POST request--Sets the form method property to post)

The 3.HEAD requires the same response as the corresponding get, but there is no response body

4.PUT Upload a specified resource

5.DELETE Delete a specified resource

Why the form submitted in Chinese will appear garbled

Why does it produce garbled characters?

When a form is submitted, the browser encodes the Chinese parameter, which is encoded using the character set of the page on which the form is opened.

Web server By default will use Iso-8859-1 to decode encoding and decoding inconsistent, there will be garbled

Solve the problem of garbled post mode

Step1: Make sure the page on which the form is located is opened according to the specified character set

<meta http-equiv = "content-type" content = "Text/html;charset=utf-8"

Step2: Decoding on the service side according to this encoding method

Request.setcharacterencoding ("Utf-8")

Add in front of read parameters

This method is valid only for post requests.

 

Type of request method garbled processing method

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.