garbled situation by HTTP request can be divided into three kinds
-
POST, this garbled is in fact the easiest to solve, in spring, for example, set the filter to cast the character encoding UTF-8 can be.
-
get, Chinese characters in the URL string.
workaround one: transcode the parameter values in the background
workaround three: client like JS Call the encodeURI method to pass the parameter transcoding again.
I think this is the best solution, which can effectively compensate for the shortcomings of the previous two methods. The service side wants to add the decoded portion, Urldecoder.decode (str, "UTF-8").
ps:js transcoding to call two encodeURI, while the flex client needs to be called only once.
-
Post Upload file
Why take this alone? Because the upload request information contains two parts, one is the request body, which is the part that sends the binary data of the file. The other is the attribute parameters, such as file name, and so on, these parameters are similar to get, is sent with the URL, so if the traditional post processing, the file name garbled is not resolved. Then you should apply the get workaround here.
Java Web Chinese garbled solution