0 Replies Latest reply on Dec 15, 2006 11:44 PM by watchcat

    UTF encoding in address field

    watchcat

      I have some problem. It not fatal, but i don't known how to eliminate it.
      Jboss 4.0.5 GA ( with tomcat ).
      Tomcat connector was configured this way:

       <Connector port="80" address="${jboss.bind.address}"
       maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
       emptySessionPath="true"
       useBodyEncodingForURI="true"
       URIEncoding="UTF-8"
       enableLookups="false" redirectPort="8443" acceptCount="100"
       connectionTimeout="20000" disableUploadTimeout="true"/>
      

      And in ROOT.war i place some test jsp-file (testenc.jsp, UTF-8 codepage)
      <%@ page import="java.net.URLEncoder" %>
      <%@ page import="java.util.Enumeration"%>
      <%@ page contentType="text/html;charset=UTF-8" %>
      <html>
      <head>
      <title>testenc.jsp page</title></head>
      <meta http-equiv="pragma" content="no-cache" />
      <!meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <body>
      <%=request.getCharacterEncoding()%>
      <table>
      <% Enumeration pnms = request.getParameterNames();
       while (pnms.hasMoreElements()) {
       Object o = pnms.nextElement();
       String[] v = request.getParameterValues(o.toString());
       StringBuffer sb = new StringBuffer();
       for (int i = 0; i < v.length; i++) sb.append(v).append("|");
       %><tr><td><%=o.toString()%></td><td><%=sb.toString()%></td><td><%=request.getParameter(o.toString())%></td></tr><% }%>
       </table>
       <a href="testenc.jsp?param=<%=URLEncoder.encode("???????", "UTF-8")%>">???????</a><br/>
       </body>
       </html>
      


      In bowser page showing normally, and reference working fine.
      But if i manually type "/testenc.jsp?param=???????" in url-field then browser recode Russian symbols in form:
      /testenc.jsp?param=%D0%F3%F1%F1%EA%E8%E9 (Windows-1251?)
      instead of:
      /testenc.jsp?param=%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9
      although with wikipedia.org browser works correctly.

      Sorry for my English. :)