gpt4 book ai didi

android - Web 服务给出异常

转载 作者:行者123 更新时间:2023-11-29 01:45:12 25 4
gpt4 key购买 nike

我在我的网络服务中传递了 Emailbody:

String emailBody="<span style='font-size: 14px;font-family:" +
" Arial;'>Following task is now completed.<table width=" +
"'100%' cellpadding='0' cellspacing='0'><tr><td style=" +
"'height: 2px; background-color:'></td></tr>" +
"</table><p>"+remark+"</p> " +
"Completion Date: "+fmdate+"<br /><br /><br /><i>Note: This is automated message. Please do not reply to this email. If you have questions, please contact your Care Team Members.</i></span>";

我的网络服务代码是:

ProgressDialog Dialog;
boolean flag;
String call_method,method1;
HttpClient client;
XmlPullParserFactory factory;
HttpResponse res;
XmlPullParser parser;

@Override
protected Result doInBackground(String...value) {
// TODO Auto-generated method stub
Log.d("submit", "Login");

method1=value[0];
call_method=value[1];
method1=removeSpace(method1);
method1=removePlus(method1);
String method=variable.host+call_method+method1;
Log.d("method","==>"+method);

HttpGet get;
try {
get=new HttpGet(new URI(method));
//get=new HttpGet(new URI(URLEncoder.encode( method , "UTF8" )));

res =LogInActivity.client.execute(get);



factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
Log.i("Bhavik","Response : "+res.getStatusLine().toString());

parser = factory.newPullParser();
parser.setInput(new InputStreamReader(res.getEntity().getContent()));

Log.d("Bhavik", "In Side HTTP "+call_method);


if(call_method.equals("SaveMesage?")){

System.out.println("hello world");

}else{
Messge_Detail_parser pd=new Messge_Detail_parser();
flag=pd.replyData(parser);

}


}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;

}

我的异常(exception)是:-

java.net.URISyntaxException: Illegal character in query at index 231: 

请帮助我如何在网络服务中传递 Html 标签。提前致谢。

最佳答案

您好,请尝试使用 HTML.fromhtml()URLEncoder.encode(String) 并确保在您当前的字符串中,请检查位置处的字符232,如果是不需要的不必要的空白,可能会出现这个错误。通过对您的字符串数据使用修剪功能来替换不需要的不必要的空格。

关于android - Web 服务给出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21898052/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com