title: Can't get character encoding to work from android client with resttemplate and json
body: <p>Ok, so ive tried everything but asking at stackoverflow... </p>
  
  <p>I'm trying to perform a REST call with some http params from an Android using httpclient and resttemplate to a server-side Spring controller. All my Swedish chars end up on the server as '\u001A'...</p>
  
  <p>setting up httpclient and resttemplate code:</p>
  
  <pre><code>HttpClient httpClient = new HttpClient();
  
  Credentials defaultcreds = new UsernamePasswordCredentials(msisdn, password);
  httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM), defaultcreds);
  
  //httpClient.getParams().setContentCharset(prefs.());
  httpClient.getParams().setCredentialCharset(prefs.getCredentialsEncoding());
  
  CommonsClientHttpRequestFactory requestFactory = new CommonsClientHttpRequestFactory(httpClient);
  
  RestTemplate restTemplate = new RestTemplate(requestFactory);
  
  // Add message converters
  List&lt;HttpMessageConverter&lt;?&gt;&gt; mc = restTemplate.getMessageConverters();
  MappingJacksonHttpMessageConverter json = new MappingJacksonHttpMessageConverter();
  
  List&lt;MediaType&gt; supportedMediaTypes = new ArrayList&lt;MediaType&gt;();
  supportedMediaTypes.add(MediaType.APPLICATION_JSON);
  json.setSupportedMediaTypes(supportedMediaTypes);
  mc.add(json);
  restTemplate.setMessageConverters(mc);
  
  return restTemplate;
  </code></pre>
  
  <p>I then prepare a httpentity with my parameter:</p>
  
  <pre><code>HttpHeaders headers = new HttpHeaders();
  headers.setContentType(MediaType.APPLICATION_JSON);
  headers.add("myparam", "" + "å");
  HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(headers);
  </code></pre>
  
  <p>I finally make the rest call:</p>
  
  <pre><code>ResponseEntity&lt;UserStatusTO&gt; response = rest.exchange(url, HttpMethod.GET, entity,
              MyResponseClass.class);
  </code></pre>
  
  <p>On the server, i have a jackson deserializer and my spring controller method looks like:</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.GET, value = "/event/out", headers = "Accept=application/json", produces = {"application/xml;charset=UTF-8", "application/json;charset=UTF-8"})
  public
  @ResponseBody
  UserStatusTO out(Authentication auth, @RequestHeader(value="myparam", required =  false) String myparam) {
  </code></pre>
  
  <p>All the special chars end up as \u001a ! I've tried tons of stuff, re-encoding the strings manually client AND server side, none worked. I've tried fiddling with the 
      httpClient.getParams().setContentCharset();
      httpClient.getParams().setUriCharset();</p>
  
  <p>None worked as far as i could tell.</p>
  
  <p>I'm out of ideas! If anybody has any input, i'd be much obliged. Thanks!</p>