Solution to Chinese garbled code of HTTP request in Android
Solution to Chinese garbled code of HTTP request in Android
Coding parameters
Android sends HTTP requests. The default Android code is UTF-8.
Problem Description:
The request has been set as UTF-8 in the above code, and all the codes in the server are UTF-8, but the server still has garbled codes when obtaining Chinese.
Because the server is not developed by itself, we can't see how the server runs. We only know that the code is UTF-8.
For the same server, the iPhone client sends Chinese without garbled code.
Problem solving:
Try printing the HTTP header of andorid and iPhone.
It is found that the content type is different.
So try adding a header to the request
Then the problem is solved.
If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!