user767247
user767247

Reputation: 109

java.lang.IllegalArgumentException: Illegal character in query at index 136 in Android

ERROR/java.lang.IllegalArgumentException(337): java.lang.IllegalArgumentException: Illegal character in query at index 136

I am getting this error when I'm trying to post data and image.

Upvotes: 5

Views: 22992

Answers (3)

AnilPatel
AnilPatel

Reputation: 2366

you try

String link="http://example.php?string1="+URLEncoder.encode(string1)+"&string2="+URLEncoder
.encode(string2)+"&string3="+URLEncoder.encode(string3)+"&string4="+URLEncoder.encode(string4)+"";

Upvotes: 15

Klaasvaak
Klaasvaak

Reputation: 5644

Try URLEncoder.encode(String) or HTML.fromhtml()

Upvotes: 7

Siva K
Siva K

Reputation: 4968

i your name String check the character at position 337, if it is to be a unwanted white space this error use to occur. Replace the white spaces by using trim

Upvotes: 1

Related Questions