title: UTF-8 encoding problem with servlet and apache HttpClient
body: <p>I have a servlet that sends a string with utf-8 encoding. Also I have a client written with apache httpcomponents library.</p>
  
  <p>My problem is reading the response in utf-8. Some special characters like ñ or ç are not read correctly. If I test the server with an html page sending a request, the string is correct and the encoding is UTF-8 without BOM.</p>
  
  <p>Some snippets:
  <strong>Servlet</strong></p>
  
  <pre><code>response.setContentType ("application/json; charset=UTF-8");
  PrintWriter out = response.getWriter ();
  out.write (string);
  </code></pre>
  
  <p><strong>Client</strong></p>
  
  <pre><code>entity = response.getEntity ();
  entity.getContentEncoding (); //returns null
  resultado = EntityUtils.toString (entity, HTTP.UTF_8); //Some characters are wrong
  </code></pre>
  
  <p>Has anyone had the same problem?</p>
  
  <p>SOLVED:
  Sorry guys the client and server were working correctly. I'm writting an android app and it seems that the logcat (where I print the messages) doesn't support utf-8 encoding.</p>