Java to accept from the Android client sent over the GET request, there is garbled solution ideas and methods

Source: Internet
Author: User

This afternoon encountered a very common feeling, but the degree of Niang n times, but always found no effective solution, so, in the case of the suffering of others without fruit, the study of a simple and effective method, the concrete realization of the following ideas :

(1). Let the Android client pass String str = urlencode.encode (str, "Utf-8") before sending a GET request; Specifies that the encoding format is UTF-8, so that the Android client sends the request to the server in UTF-8 format.

(2). The server side obtains the parameter value through the Request.getparameter ("str") method. This gets the value of the parameter will not appear garbled situation!

Note: (1) in STR refers to the variable name that needs to be specified in the encoding format.

Harvest: Before the client sends the request, first try to prevent its garbled situation, or the background will be garbled to turn out the Chinese will be very difficult!

The filter in the Web. xml file is generally a garbled filter for post requests and cannot filter the garbled of GET requests.

Many of these problems seem to be common and simple, but they can be the killers who waste your precious time.

Java to accept from the Android client sent over the GET request, there is garbled solution ideas and methods

Related Article

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.