【发布时间】:2012-11-06 14:12:35
【问题描述】:
嗨,在我的 android 项目中,我正在调用 web 服务并通过查询字符串参数发送 get 参数,现在的问题是,如果查询字符串参数值包含任何空格,那么我会收到 505 错误
URL url = new URL(urlstring.trim());
urlConnection = (HttpURLConnection) url.openConnection();
int response = urlConnection.getResponseCode();
我有一个疑问,如果我使用URLEncode(urlstring.trim(),"UTF-8")我是否还需要更改我的网络服务代码?
【问题讨论】:
-
你应该只编码你的参数值,而不是完整的 URL
标签: java android apache http-status-code-505