You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/12/15 09:23:32 UTC

DO NOT REPLY [Bug 25526] New: - tomcat parses the query string parameters as iso-8859-1

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25526>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25526

tomcat parses the query string parameters as iso-8859-1

           Summary: tomcat parses the query string parameters as iso-8859-1
           Product: Tomcat 4
           Version: 4.1.29
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: pkor@exodus.gr


Tomcat allways parses the query string parameters as iso-8859-1 url encoded.
If the page that submits the data has UTF-8 encoding like:
<%@ page contentType="text/html;charset=utf-8"%>

And even have the SetCharacterEncodingFilter set to UTF-8 in the web.xml

<filter>
  <filter-name>SetCharacterEncoding</filter-name>
  <filter-class>filters.SetCharacterEncodingFilter</filter-class>
  <init-param>
    <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
  </init-param>
  <init-param>
    <param-name>ignore</param-name>
    <param-value>false</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>SetCharacterEncoding</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

You have to do the following trick in the page that handles the request to get
the correct encoding:

String param = new
String(request.getParameter("param").getBytes("iso-8859-1"),"utf-8");

Changing to POST works ok.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org