0

在我的应用程序中,我试图向 url 发送电子邮件和密码,作为回报,我用来获取成功消息或错误消息。当我点击api时,返回数据如下

10-07 18:09:41.209: ERROR Data ?Error: Email and password do not match. Please try again!
10-07 18:10:47.698: ERROR Error(6363): java.lang.ArrayIndexOutOfBoundsException

问题是因为?错误一词之前

所以我想在我的代码中编码返回数据如下

HttpResponse rsp = client.execute(get);
tmpstr = URLEncoder.encode(EntityUtils.toString(rsp.getEntity()),"utf-8"); 
Log.e("Data ",""+tmpstr);

我尝试了上面和下面的方法

HttpResponse rsp = client.execute(get);
tmpstr = URLEncoder.encode(EntityUtils.toString(rsp.getEntity()),"utf-8"); 
Log.e("Data ",""+tmpstr);
String data = URLEncoder.encode(tmpstr,"UTF-8");
Log.e("returned dataaaaaaaaaaaaaaaaaaaaaaaaaa ",""+data);

在这两个代码中,我都得到了相同的错误,如下所示

10-07 21:01:47.698: ERROR(6363): Data %EF%BB%BFError%3A+Email+and+password+do+not+match.+Please+try+again%21
10-07 21:01:47.698: ERROR(6363): java.lang.ArrayIndexOutOfBoundsException

如何解决这个问题

4

2 回答 2

0

你确定你必须使用URLEncoder来编码这样的错误信息吗?我猜URLEncoder期望一些格式像 URL 的字符串,而您传递的字符串看起来不像 url。

于 2011-10-14T15:30:32.560 回答
0

The answer for this question is given by Maxim in the comments part. i have mentioned this here in order to close this question....

于 2011-12-16T04:25:07.767 回答