0 Replies Latest reply on Jul 8, 2014 5:25 AM by hai_feng

    URIEncoding of wildfly

    hai_feng

      Hi everybody!

      Sorry I ask about URIEncoding again,it confused me really. I writed a jsp as following:

      <%@ page language="java" contentType="text/html; charset=utf-8"

          pageEncoding="utf-8"%>

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

      <html>

      <head>

      <meta http-equiv="Content-Type" content="text/html; utf-8">

      <title>Insert title here</title>

      </head>

      <body>

      <a href="TestEncoding?username=测试编码">测试编码</a>

      </body>

      </html>

       

      TestEncoding.java was writen as following:

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 

      // TODO Auto-generated method stub

        System.out.println(request.getParameter("username")); 

      }

      the console can't print correct String of "测试编码",but "????????????".

      on tomcat we can solve this problem by add "URIEncoding="utf-8" to server.xml to modify server's charset,because tomcat's default URIEncoding is ISO-8859-1. In the same way,I also want to modify wildfly's URIEncoding to "utf-8",but from wildfly's document i found "utf-8" is wildfly's default URIEncoding already,what is described as following:

      Connector configuration Undertow provides HTTP, HTTPS and AJP connectors, which are configured per server.

      Common settings The following settings are common to all connectors:

      en2.jpg

      and i found that wildfly's default URIEncoding is UTF-8:

      en1.jpg

      so i don't have to modify the URIEncoding of wildfly theoretically.But why the console print "????????????" not "测试编码".

      I know this configuration can influence the encode the GET methor of <form> tag,but why it has no effect on "<a />" tag.

      Is there any way I can modify to make <a/> tag's chinese print correctly?

       

      I look forward to your anwser,Thanks!