Solution to Chinese garbled code problem of Android retrofit

Solution to Chinese garbled code problem of Android retrofit

When using retrofit and rxjava, when submitting data, it should be noted that when the data is in Chinese, it may be garbled when it is transmitted to the background, which needs to be handled:

solve:

1. Change the get request to post;

2. Change the parameter field to query

3. Add @ formurlencoded

As follows:

Solution example:

In this way, there will be garbled code in the background of reporting: (if name and remark have Chinese)

Amend to read:

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!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>