Using Post submission
If the submission is post, think not garbled, just need to set up the request object in the server code can be, the client in which encoding to submit, server-side Request object to the corresponding code to receive, such as the client is submitted in UTF-8 code, The server-side Request object is received in UTF-8 encoding (request.setcharacterencoding ("UTF-8")) using get commit
If the Submit method is get, the encoding for the request object is invalid, and the request object receives the data with the default iso8859-1 encoding, so you can only convert the data manually after you receive it, as follows:
Gets the data that the client submits, gets the garbled string, data= "??? È????? "
Look up the Iso8859-1 code table and get the byte array of the raw data submitted by the client
Constructs a string from a byte array to the specified encoding, resolving garbled
Constructs a string with the specified encoding in a byte array, where the specified encoding is based on the character encoding used by the client to submit the data, if it is GB2312, then set to data = new string (source, "GB2312"), if it is UTF-8, Then set to data = new String (source, "UTF-8")
Reference articles:
Http://www.cnblogs.com/xdp-gacl/p/3798347.html