I'm using Android to send English and Arabic content to Servlet but the data goes to the server with. How to solve it ? here is my code in Android:
StringEntity se = new StringEntity(gsonString);
se.setContentType("text/json;charset=UTF-8");
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json;charset=UTF-8"));
HttpPost httpRequest = new HttpPost(methodURL);
httpRequest.setEntity(se);
HttpResponse response = httpClient.execute(httpRequest,localContext);
Servlet code
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream()));
String line = in.readLine();
String gsonString = line;
while (line != null) {
gsonString += line;
line = in.readLine();
}
any suggestions ?