First, the client code, the server and then decode.
Client sends data:
var names = encodeURIComponent ("Electricity");
names = encodeURIComponent (names);
$.post ("test.do?names=" +name,null, Function () {});
Service-Side decoding:
Gets the names parameter value and then decodes it.
String name = Urldecoder.decode (names, "UTF-8");
Note: You must encode two times with encodeURIComponent.
Second, specify the encoding format for UTF-8 on the Tomcat service side
Although the use of a way to solve the problem, but very inconvenient, when there are many places in the page to be transmitted in Chinese, each place must first code two times, and then decode. So it is recommended to use this method.
<connector uriencoding= "UTF-8" connectiontimeout= "20000" port= "8080" protocol= "http/1.1" redirectport= "8443"/ >
The above jquery transmission of Chinese garbled problem simple solution is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.