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