title: ObjectMapper Not Handling UTF-8 Properly?
body: <p>I'm using ObjectMapper to serialize posts in my system to json. These posts contain entries from all over the world and contain utf-8 characters. The problem is that the ObjectMapper doesn't seem to be handling these characters properly. For example, the string "Musée d'Orsay" gets serialized as "Mus?©e d'Orsay".</p>
  
  <p>Here's my code that's doing the serialization:</p>
  
  <pre><code>public static String toJson(List&lt;Post&gt; posts) {
          ObjectMapper objectMapper = new ObjectMapper()
              .configure(Feature.USE_ANNOTATIONS, true);
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          try {
              objectMapper.writeValue(out, posts);
          } catch (JsonGenerationException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (JsonMappingException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          return new String(out.toByteArray());
      }
  </code></pre>
  
  <p>Interestingly, the exact same <code>List&lt;Post&gt; posts</code> gets serialized just fine when I return it via a request handler using @ResponseBody using the following configuration:</p>
  
  <pre><code>public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) {
      ObjectMapper m = new ObjectMapper()
          .enable(Feature.USE_ANNOTATIONS)
          .disable(Feature.FAIL_ON_UNKNOWN_PROPERTIES);
      MappingJacksonHttpMessageConverter c = new MappingJacksonHttpMessageConverter();
      c.setObjectMapper(m);
      converters.add(c);
      super.configureMessageConverters(converters);
  }
  </code></pre>
  
  <p>Any help greatly appreciated!</p>