1

I implemented google authentication in my android app. I need to send gmail id, username to my server for account authentication. Everything was working fine until I tried to login with a Bengali username.

Here is my code to access sever

HttpAsyncTaskCheckAuth checkAuth = new HttpAsyncTaskCheckAuth(SignUpActivity.this);
                checkAuth.execute("http://www.server_address.com//auth/login?email=" +
                        email +
                        "&name=" + name +
                        "&logged_in=" + "true");

Here I an getting email and name from google plus authentication in android. How can I solve this language issue? Do I need to parse the name(user name) in any international formate so that the server can proceed with it?

Please suggest me some solutions to get rid of this problem.

anuradha
  • 692
  • 1
  • 9
  • 22
  • Please, check if [this](http://stackoverflow.com/questions/3286067/url-encoding-in-android) can solve your issues. Most servers expect UTF-8 encoded query. And most if not all libraries will convert them. It is possible that a `MalformedURLException` or something else is being triggered locally (and thus we need the Logcat), or the server is simply ignoring your request, replying some `HTTP 500` response (and thus we would need the server logs). – Bonatti Sep 26 '16 at 17:06
  • This is ***EXACTLY*** the same problem as this: http://stackoverflow.com/questions/39699758/android-language-parsing-difficulties/39700660?noredirect=1#comment66699767_39700660. This question will most likely be tagged as ***DUPLICATE***. If your question does not receive enough attention, you can use the ***Bounty*** feature after few days. – user1506104 Sep 26 '16 at 18:38

1 Answers1

0

You need to encode the query parameter values. There are various ways of doing that, one of them is to use the apache commons - codec library:

org.apache.commons.codec.net.URLCodec.encode(name);

See also how to encode URL to avoid special characters in java

Community
  • 1
  • 1
yaba
  • 829
  • 7
  • 11