Post UTF-8 encoded data to server loses certain characters
After much research and attempts to make things working, I finally found a solution for the problem, that is a simple addition to existing code. Solution was to use parameter "UTF-8" in the UrlEncodedFormEntity class constructor:
form = new UrlEncodedFormEntity(nameValuePairs,"UTF-8");
After this change, characters were encoded and delivered properly to the server side.
When you do this line
form = new UrlEncodedFormEntity(nameValuePairs);
you need to specify the charset like this
form = new UrlEncodedFormEntity(nameValuePairs,"UTF-8");
You can go to Android Developer find out.
Constructs a new UrlEncodedFormEntity with the list of parameters with the default encoding of DEFAULT_CONTENT_CHARSET
String finalString = URLEncoder.encode(request, "UTF-8");return finalString;
user finalString in your post method.