0 Replies Latest reply on Sep 26, 2018 10:41 AM by bernhard65

    Different encoding behavior in Wildfly-14

    bernhard65

      I want to migrate to Wildfly-14 but i'm facing a problem:

       

      A request to the following REST-Endpoint gives different answers in Wildfly-14 and Wildfly-13:

       

          @GET

          @Path("data")

          @Produces(MediaType.APPLICATION_JSON)

          public List<String> getData(@Context HttpServletRequest request) throws NotFoundException {

              List<String> l = newArrayList();

              l.add("aou");

              l.add("äöü");

              return l;

          }

       

      The german umlaute wont be transportet UTF-8-encoded to the client in Wildfly-14.  In Wildfly 13 and before all works fine and the response is send utf-8-encoded.

       

      I found two workarounds:

       

      1. Enhance MediaType with charset so it looks like    

           @Produces(MediaType.APPLICATION_JSON+";charset=utf-8")

      2. Start Wildfly with JAVA_OPTS "file.encoding=UTF-8"

       

      but both settings were not necessary in Wildfly-13

       

      Does anybody have an explanation for the different behavior and a better solution than the two workarounds?

      Thank you!

       

       

      PS: I found out that starting Wildfly-14 with -Dresteasy.preferJacksonOverJsonB=true gives me the expected UTF-8 encoded result.

       

      Nachricht geändert durch Bernhard Kunz