3 Replies Latest reply on May 8, 2014 10:43 PM by Wind Wild

    What is WildFly's default encoding and how to set another encoding for WildFly?

    Wind Wild Newbie

      Hi everyone

      I want to know how to set encoding for WildFly.

      There is a ducument about it as following issue:[WFLY-2533] Add ability to set default character encoding on a subsystem level - JBoss Issue Tracker

      and i configured follow it,but there seem no availble.

      my WildFly install on linux os,following pictrue you can see on the WildFly‘s file.encoding is utf-8

      en5.bmp

      and I set default-encoding as follow:

       

      en2.bmp

      my web project's encode is utf-8 also,now i print a sentence with chinese:

      en3.bmp

      but when i go to http://10.19.220.172:8080/snf-helloworld-sample/index

      there is not the sentence what i writeen in the java file when i see the server log,because there is no chinese:

      en4.bmp

      I don't know why,I have alrendy set the default encoding to utf-8.Is it wrong what i set?who can tell me about?

      Thanks!

        • 1. Re: What is WildFly's default encoding and how to set another encoding for WildFly?
          Tomaz Cerar Master

          You configured encoding properly. As far as WildFly configuration goes.

           

          but, your debugging process is flawed.

           

          you are testing servlet encoding outputs but you are outputting to system out, where encoding has noting to do with servlet or WildFly at all.

           

          you should make sure that your console support UTF encoding and make sure your compiler is configured to compile using UTF8.

           

          what you are testing could be tested by simple public static void main app no need for servlets.

           

          To test servlets encoding try writing to servlet's response writer / outputstream and see it in browser.

           

          --

          tomaz

          • 2. Re: What is WildFly's default encoding and how to set another encoding for WildFly?
            Wind Wild Newbie

            Hi Tomaz Cerar

            Thanks replying to me,the same as you say,because my console's encode isn't utf-8,so it can't show chinese.I modify it to utf-8 and it show formally.

            Now,I want to make sure one thing.If my project's encode is GBK,I can modify the WildFly’s encoding by this way as following?

            Setting default-encoding to "GBK"

            Is it the correct way to modify WildFly uri encoding?Does it work?

            I know on the JBoss As 7,we can configure it by modify standalone.xml as following:

            <system-properties>

             

                 <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>

             

                 <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>

             

            </system-properties>

            But I don't how to set it on WildFly,please tell me a exactly answer,thanks!

            • 3. Re: What is WildFly's default encoding and how to set another encoding for WildFly?
              Wind Wild Newbie

              Thanks Tomaz

              I know what you say,and i test successfully.

              1 of 1 people found this helpful