|Summary:||CGIServlet applies wrong charset|
|Product:||Tomcat 5||Reporter:||Motoyoshi Sugiu <motoyoshi_sugiu>|
|Component:||Servlets:CGI||Assignee:||Tomcat Developers Mailing List <dev>|
|Attachments:||A revised CGIServlet based on Tomcat 5.5.15 source.|
Description Motoyoshi Sugiu 2006-03-01 09:32:18 UTC
Suppose the CGI header contains: content-type: text/plain; charset=shift_jis This content type is exactly set to the header of the servlet response. However, both the reader of the CGI output and the writer of the servlet output always apply the platform's default character encoding, since InputStreamReader and OutputStreamWriter are constructed without charset. I've already written the patch. Please contact me by email, then I can send you the revised CGIServlet (the source came from 5.5.15).
Comment 1 Motoyoshi Sugiu 2006-03-01 09:35:29 UTC
Created attachment 17811 [details] A revised CGIServlet based on Tomcat 5.5.15 source.
Comment 2 Motoyoshi Sugiu 2006-03-01 09:44:30 UTC
The revised code was attached. In order to solve this problem, the following steps are made. (1) charset is extracted from the content-type in CGI header. (2) servletContainerStdout is created for the specified charset if any. (3) commandsStdOut is created for the specified charset if any.
Comment 3 Mark Thomas 2006-03-06 17:49:40 UTC
Fixed using an alternative patch that removed the Stream -> Reader -> Stream conversions that were causing the problem.