怪我咯2017-04-18 10:33:33
Not all parameters need to be encoded. Using URLEncoder
是一种解决方式,但是并不是必须的选择。
但是如果你的参数中带有URI
保留字,那你必须要使用URLEncoder
。比如你的参数中带有/&?=
...这类保留字,如果你不编码那解析URL
to solve Chinese garbled characters is definitely not the result you expect.
RFC 3986 2.2. Reserved Characters
迷茫2017-04-18 10:33:33
The browser will automatically do URLEncoder.encode once, no need to manually URLEncoder.encode
巴扎黑2017-04-18 10:33:33
In the Android code, I use android.net.Uri.encode(). If I am not sure whether there are special characters in the parameters, I just add them. It is not complicated.