android send utf8 content to servlet

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.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
HttpPost httpRequest = new HttpPost(methodURL);
HttpResponse response = httpClient.execute(httpRequest,localContext);

Servlet code

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 ?


HttpClient httpClient = new DefaultHttpClient();
        HttpContext localContext = new BasicHttpContext();

Gson gson = new Gson();
        String gsonString = gson.toJson(currentCustomer);
        Log.v("gson", gsonString);

        StringEntity se = new StringEntity(gson.toJson(currentCustomer),
HttpPost httpRequest = new HttpPost(methodURL);
        httpRequest.setHeader("customerRegisrationData", gsonString);

        HttpResponse response = httpClient.execute(httpRequest,

Use these methods

HttpPost httpPost = new HttpPost(method_url);

StringEntity postEntity = new StringEntity(HTTP.UTF_8);


httpPost.setEntity(new UrlEncodedFormEntity(postData));

Need Your Help

Sending a password to Gmail from my Android javamail app

android security encryption passwords gmail

I'm writing an Android email client app, based on the Javamail API. I can log into GMail accounts from it, but I want to make sure that the login process is actually secure.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.