0

Url我用来解析读取的文档Json是:

https://graph.facebook.com/150205375156742/feed?access_token=520625188052604|GsCYVGBJKs5N_O1AX9XrrsulrWc

这是扔IllegalArgumentException

04-19 23:08:02.220: E/AndroidRuntime(17068): Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 76: https://graph.facebook.com/150205375156742/feed?access_token=520625188052604|GsCYVGBJKs5N_O1AX9XrrsulrWc

当我尝试使用urlEncoder.encode()它对 url 进行编码时,会导致另一个异常:

04-20 11:43:16.280: W/System.err(31984): java.net.UnknownHostException: Unable to resolve host "graph.facebook.com": No address associated with hostname
4

1 回答 1

0

当我尝试对 url 进行编码时

不要对整个 URL 进行 URL 编码。只需对部分进行编码,例如access_token. 那应该|变成%7c.

于 2015-04-20T07:06:32.447 回答