Nir*_*ari 9 java https android http http-headers
我试图发送邮件请求到webservice ..当我在参数中添加特殊字符@它被转换为%40.i已检查服务器端..他们正在获得%40而不是@.谁能帮我??这是我的代码..
httpclient = new DefaultHttpClient();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("Email", "abc@gmail.com"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String response = httpclient.execute(httppost,responseHandler);
Run Code Online (Sandbox Code Playgroud)
我也尝试过这种方法来防止我的参数编码.
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.PLAIN_TEXT_TYPE));
Run Code Online (Sandbox Code Playgroud)
但它提出了不受支持的编码算法
请帮我解决这个问题.
您可以使用
URLDecoder.decode("urlcontext", "UTF-8");
Run Code Online (Sandbox Code Playgroud)
从您传递的网址中删除任何特殊字符
| 归档时间: |
|
| 查看次数: |
45943 次 |
| 最近记录: |