The problem of Chinese garbled characters on the Android connection server

  This is a common problem, I will give my troubleshooting and solutions.

  Prerequisites   :
  APP side: android uses volley to send requests;
  server side: SPINGMVC

  Problems: The request parameters received by the server side have Chinese garbled   characters   . Grab the package on the Android side .










     Check as follows and find that there are garbled characters in the request parameters (because the server needs to convert the object to json format, at first I just converted the url+json to utf-8 once, it turns out that I am too young, too simple. )


  3. Check the Android code, transcode into utf-8 for each attribute in the object when setting it

  4. Check the controller in the spingmvc on the server and find that there is no forced transcoding (skip)

  5. Check the configuration of the server, tomcat The following server.xml is modified to

<Connector Encoding="UTF-8" URIEncoding="UTF-8" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"/>


  problem solved

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326638026&siteId=291194637