tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36814] New: - Parameter for POST encoding
Date Mon, 26 Sep 2005 13:18:33 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36814>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36814

           Summary: Parameter for POST encoding
           Product: Tomcat 5
           Version: 5.5.9
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: Udo.Walker@abas.de


There is a problem to convert the incoming request of a POST request to the
right character encoding. Mostly the browsers do not send the correct request
header so Tomcat falls back to the default encoding which is ISO-8859-1. But in
a multi language environment (e.g. mixture of english, european, chinese, etc.
languages) ISO-8859-1 is not sufficient and UTF-8 is more recommended.

To tell Tomcat to use e.g. UTF-8 as the default encoding I suggest to change the
source code of Request.java in the package org.apache.catalina.connector so that
the encoding is read from a context parameter:

/**
 * Return the character encoding for this Request.
 */
public String getCharacterEncoding() {
  String enc = coyoteRequest.getCharacterEncoding();
  if (enc == null) {
    return getDefaultPostEncoding();
  }
  return enc;
}

/**
 * Get the default encoding for parameters of requests with post method.
 */
private String getDefaultPostEncoding() {
  return context.getServletContext().getInitParameter("defaultPostEncoding");
}


To use this with UTF-8 encoding you have to add this to the <Context> of your
webapp:

<Parameter name="defaultPostEncoding" value="UTF-8"
           override="false"/>


What do you think? Is this a good enhancement for Tomcat? It would be great if
you could add this to the base code of Tomcat. Probably many Tomcat users would
be glad to have it, wouldn't they?

With regards

Udo Walker

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message