Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception "Illegal character in query at index -" in Android

I am trying to send data on server using following link.

**WEBSERVICE LINK:**
http://75.125.237.76/post_reviews.php?data=text1

If I set data filed with single string (ex:data=text1), That time my try block in source code working fine, without any exception.

But When I set data field with multiple string with spaces (ex: data=text1 text2 text3), Then Exception generated i.e. Illegal character in query.

**EXCEPTION:**
Illegal character in query at index 75: http://75.125.237.76/post_reviews.php?data=text1 text2 text3

My question is Why exception generate when we use multiple strings (like: data=My name is xyz).

If I replace data field with single string that time is working fine.(data=xyz)

like image 787
Ranjit Chandel Avatar asked Dec 07 '25 04:12

Ranjit Chandel


1 Answers

Encode space with %20 have a look at this one for more encodings

like image 185
Abubakkar Avatar answered Dec 08 '25 16:12

Abubakkar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!