5

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.

3
  • 1
    You need to provide the code and relevant information. We don't even know what line 136 is Commented Aug 31, 2011 at 5:01
  • 136 is not line no..it is index no. and line no. is 337 that is url in which i m passing id,session id, and name..i am passing name blank... Commented Aug 31, 2011 at 5:08
  • 3
    Sorry, you are right :) But you do need to provide the code where the error is otherwise it's hard to help you. Most people here would be able to help provided we have enough information. Did you put empty string when you say the name is blank or just leave it as is? Commented Aug 31, 2011 at 5:16

3 Answers 3

15

you try

String link="http://example.php?string1="+URLEncoder.encode(string1)+"&string2="+URLEncoder
.encode(string2)+"&string3="+URLEncoder.encode(string3)+"&string4="+URLEncoder.encode(string4)+"";
Sign up to request clarification or add additional context in comments.

Comments

7

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

1 Comment

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.