sss
sss

Reputation: 59

Encode Edittext string

Creating app in which my requirement is to pass encode data of string.I have Edittext and i have to encode editext text.I am doing this.

String getstr="#"+((Editext)findviewbyid(id)).getText.tostring;

String s = URLDecoder.encode(getstr, "UTF-8");

Suppose Editext text is "my data " But i am not getting proper response. I am getting

%23my%2bdata%2b

If there is space it should be %20 but why i am getting this. String should be

%23my%20data%20.

Does any one has idea.What i am doing wrong.

Upvotes: 0

Views: 25

Answers (1)

Neel Mehta
Neel Mehta

Reputation: 106

URLEncoder encodes HTML form data, not URL parameter data. Check the answers here.

Upvotes: 1

Related Questions