0 Replies Latest reply on Jul 25, 2018 9:56 AM by K DelCastillo

    WildFly 8 - How to change the charset encoding in application level?

    K DelCastillo Newbie



      I would like to ask if there is a way to change/set the character encoding in the application level? We are using Wildfly 8 with an ear file currently deployed in it.

      I am aware that the default charset is defined in domain.xml, but we have cases wherein we use the charset indicated in the Content-type Header to be set as the character encoding for that particular request, and if it's not indicated in the header, the default charset of the listener should be used. This is working and don't have any problems when our application is deployed in Websphere and earlier version of JBOSS, but we are now encountering this when we are trying to migrate in WILDFLY. We tried forcing the request using request.setCharacterEncoding(<charset>) but this is not working.


      Here is a sample working scenario back when our application is deployed in JBOSS:

      1. Default encoding configured is UTF-8

      2. A client tries to make a GET request with charset as ISO-8859-1

      3. Our application will read this, and upon executing request.getParameter("param1"),  the value returned should be decoded using  ISO-8859-1 and not  UTF-8.


      This is not the case for WILDFLY as it is still using UTF-8 instead of what is indicated in the request header. We want to  dynamically change our character encoding, not one that is fixed in the config files.

      Is there a way to achieve this scenario in WILDFLY?


      I greatly appreciate your responses.


      Thank you