user3496326
user3496326

Reputation: 131

Illegal character in query at index , while inserting double quotes in a url

how do i resolve this error ?

HttpClient httpclient = new DefaultHttpClient();
String link="http://myurl.com/Acces/DEFAULT2.ASPX?+ivrsDetails.getAssetid()"+"\""+ivrsDetails.getTime();

HttpPost httppost = new HttpPost(link);

Illegal character in query at index 62: http://myurl.com/Acces/DEFAULT2.ASPX?+Details.getAssetid()"17:47:21

Upvotes: 0

Views: 2080

Answers (3)

user3496326
user3496326

Reputation: 131

I used url encode and it worked fine ....

HttpClient httpclient = new DefaultHttpClient();
   String link="http://myurl.com/Acces/DEFAULT2.ASPX?+ivrsDetails.getAssetid()"+ URLEncoder.encode("\\")+ivrsDetails.getTime();
HttpPost httppost = new HttpPost(link);

Is this a good way to make it work?

Upvotes: 0

duggu
duggu

Reputation: 38429

try below code :-

String link="http://myurl.com/Acces/DEFAULT2.ASPX?+ivrsDetails.getAssetid()"+"\\"+ivrsDetails.getTime();

we are using \ (backslash character) for reading special character after using \ (backslash character).

http://www.javapractices.com/topic/TopicAction.do?Id=96

http://docs.oracle.com/javase/jndi/tutorial/beyond/names/syntax.html

Upvotes: 0

log N
log N

Reputation: 945

Try this one...You have inserted an unmatched quote in the url

"http://myurl.com/Acces/DEFAULT2.ASPX?+ivrsDetails.getAssetid()"+"\\"+ivrsDetails.getTime();

Upvotes: 1

Related Questions