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=7602>. 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=7602 After RequestDispatcher.forward() the character encoding for parameters is set to ISO-8859-1 Summary: After RequestDispatcher.forward() the character encoding for parameters is set to ISO-8859-1 Product: Tomcat 4 Version: 4.0.3 Final Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I have to servlets, let's call them Forwarder and Test. I send requests (both GET and POST) to the Forwarder servlet which uses request.getRequestDispatcher to forward it to the Test servlet. I'm using Tomcat 4.0.3, but 4.0.4 produced the same. The problem is the following: when the Test servlet receives the request in doGet or doPost, or even in service(), the parameters are already parsed according to the ISO-8859-1 character encoding. This makes impossible to specify the character encoding with request.setCharacterEncoding() in the Test servlet. The Servlet API 2.3 Specification says on page 56: "Parameters specified in the query string used to create the RequestDispatcher take precedence over other parameters of the same name passed to the included servlet. The parameters associated with a RequestDispatcher are scoped to apply only for the duration of the include or forward call." So when forwarding to a path "/servlet/Test?id=5678" the original id parameter is overwritten with value 1234, if, for example the original request was /servlet/Forwarder?id=1234. I guess this overwriting is made by parsing the parameters in the original request and parsing the parameters in the path specified for the Dispatcher and after that they are merged. But at this point, the original parameters are encoded with ISO-8859-1, and I'm loosing valuable accented characters... Moreover, even posted parameters are parsed, although the specification is not clear about it, but on page 58 (SRV.8.4.1) it says "The request dispatching mechanism is responsible for aggregating query string parameters when forwarding or including requests." IMHO this means only query strings should be merged, but posted data not. Additionally the ServletInputStream is completely read (0 bytes can be read from it) in the Test servlet, so I even can't reparse the parameters. My suggestion is that neither path nor the original query string should be URLDecoded. Only those parts should be overwritten in the original query string in which the parameter name equals to any in the path string. Parameter parsing should be done in Test servlet, not in Forwarder servlet. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>