title: SpringBoot response charset errors
body: <p>i got some problems with my SpringBoot REST Controller. This simply does a http GET call to our database and should return a simple String / json. when i call the URL simply in my browser or via my angular 3 app, the response has some charset errors and i don't know, how to fix them.
  I suggest, it is a UTF-8 problem. </p>
  
  <p>First to show you the output:
  this is how it comes from the Controller: <strong>MeinekestraÃe</strong> 
  and it should be <strong>Meinekestraße</strong></p>
  
  <p>here is a part of my SpringBoot Controller:</p>
  
  <pre><code>@Controller
  public class RecieverController {
  
  @Value("${server}")
  private String server;
  
  @Value("${user.token}")
  private String token;   
  
  @RequestMapping(value="/reciever", method=RequestMethod.GET, produces = "text/plain;charset=UTF-8")
  @ResponseBody
  @CrossOrigin(origins = "http://localhost:4200", maxAge = 3600)
  public String getRecieverData(
          @RequestHeader(value="Accept") String accept,
          @RequestHeader(value="Host") String host) {
  
      final String url = server + "/rest/client/profile";
  
      RestTemplate restTemplate = new RestTemplate();
      HttpHeaders headers = new HttpHeaders();
  
      headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
      headers.set("Auth-Token", token); // user_token
  
      HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;("parameters", headers);
  
      ResponseEntity&lt;String&gt; response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
  
      return response.getBody();
  }}
  </code></pre>
  
  <p>I tried the following things, but nothing changed in the output.</p>
  
  <pre><code>spring.http.encoding.charset=UTF-8
  spring.http.encoding.enabled=true
  spring.http.encoding.force=true
  </code></pre>
  
  <p>or this</p>
  
  <pre><code>RestTemplate restTemplate = new RestTemplate();
  restTemplate.getMessageConverters()
      .add(0, new StringHttpMessageConverter(Charset.forName("UTF-8")));
  </code></pre>
  
  <p>any other ideas what could be the problem? the database isnt the issue. Everything is stored correctly there.</p>
  
  <p>Edit:
  this is the screenshot of the header from the output
  <a href="https://i.stack.imgur.com/PDmoX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PDmoX.png" alt="enter image description here"></a>
  and a part from the json output:
  <a href="https://i.stack.imgur.com/TsQ7f.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TsQ7f.png" alt="enter image description here"></a></p>
  
  <p><strong>The Problem could be solved by adding both</strong> </p>
  
  <pre><code>spring.http.encoding.charset=UTF-8
  spring.http.encoding.enabled=true
  spring.http.encoding.force=true
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>RestTemplate restTemplate = new RestTemplate();
  restTemplate.getMessageConverters()
      .add(0, new StringHttpMessageConverter(Charset.forName("UTF-8")));
  </code></pre>
  
  <p>Thanks @dienerd for helping me via chat</p>