3 Replies Latest reply on Jun 8, 2005 5:26 AM by fragavi

    Question about multi-language support

    wxwang

      It is very simple, and a jsp page submits japanese text message to another JSP by using post or get.

      Some code as following:

      <%System.out.println(request.getCharacterEncoding());
      //request.setCharacterEncoding("SHIFT_JIS");
      String name = request.getParameter("name");
      System.out.println("name: " + name);%>
      <html><head>
      <meta http-equiv="content-type" content="text/html"; charset="Shift_JIS">
      </head><body> name:
      <b><%= name %></b></body></html>


      It is working very well with english. But if I input japanese. I have got
      ???/??.

      I tried setCharacterEncoding to UTF-8 Shift_JIS and so on, but the same result comes out.

      My Application Server is JBoss 4.0.1.RC2

      Thanks

        • 1. Re: Question about multi-language support

          I'm having a simular problem. What character set is being used to post, Shift_JIS or UTF8? I believe this is controlled by either the meta tag you have in your example, or

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


          I've found it is nice to dump out the values in the String being used to see what is going on. Try something like:

          public static void dumpString(String str) {
           System.out.println("!!! str = '" + str + "' length = '" + str.length() + "'");
           for(int i=0; i < str.length(); i++) {
           char ch = str.charAt(i);
           System.out.println("!!! str[" + i + "] = '" + ch + "' 0x" + Integer.toHexString(ch));
           }
           }
          


          Try setting the URIEncoding attribute in the tomcat server.xml (/jboss/server/default/deploy/jbossweb-tomcat50.sar/ on JBoss 4.0.0).

          Hope this helps,
          Josh

          • 2. Re: Question about multi-language support
            wxwang

            Thank you very much

            I did it.

            The problem is caused by my custom form authenticator, which deals with request paramter at the first time and affect the others.

            • 3. Re: Question about multi-language support
              fragavi

              Hi,

              I'm also encountering the same problem, but I'm using a different version of jboss. How do you set the encoding to UTF-8 in jboss3.0.6(WIN2000)?