You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Takashi Okamoto <to...@rd.nttdata.co.jp> on 2000/08/07 03:25:28 UTC

[PATCH] International Problem with getParameter()

Hello ,Tomcat developers.

I made a patch for 'resolve international problem' in tomcat 3.2b2.

[caution!!] Under English environment, you can't affirmation this
            problem. 
     Japanese ,Korean ,Chinese ,etc.. not English people have
            this problem!!

This problem exists at 'getParameters()' in 
'org/apache/tomcat/core/RequestImpl.java'.

getParameters() don't decode character encodings automatically.
We (not English people) avoid this problem to write next code 

--------
response.setContentType("text/html;charset=EUC_JP");
String str = request.getParameter("PARAM_NAME");
String decode_str = null;
if(str!=null){
  decode_str = new String(str.getBytes("8859_1") ,"EUC_JP");
  str=decode_str;
}
--------
This is EUC_JP(Japanese code) example.
But EUC_KR(Korea),EUC_CN(Chinese)..etc  have same problem too!!


But IBM WebSphere (3.0) and Caucho Resin don't have this problem.
They decode character encodings automatically.
and we write only:

--------
response.setContentType("text/html;charset=EUC_JP");
String str = request.getParameter("PARAM_NAME");
--------

If we apply this patch to tomcat 3.2b2 ,we are grad that we don't need
decode character encoding manually.

Could you apply this patch on next release?

And next is most important.

We decide this rule at servlet API reference.
We must indicate our character encoding by
HttpServletResponse.setContentType() before call
HttpServletRequest.getParameter() and getParameterValues method (of
course JSP is same too).

Additional infomation.

(1) Cookie has same problem. But I don't resolve it.
(2) Maybe 'Catalina' have same problem.

Thank you,read this e-mail.
I hope you understand this international problem.
----------------------
NTTDATA Corporation, R&D Headquarters
Takashi Okamoto (mailto:tokamoto@rd.nttdata.co.jp)


Re: [PATCH] International Problem with getParameter()

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Takashi Okamoto wrote:
> 
> Hans wrote:
> 
> > I'm afraid this patch has no support in the Servlet 2.2 specification.
> > A similar solution is being discussed for Servlet 2.3, but to me it
> > seems like IBM WebSphere (3.0) and Caucho Resin are doing things that
> > are not in line with the current spec.
> 
> I see.
> I found Servlet 2.3 document.
> http://java.sun.com/aboutJava/communityprocess/jsr/jsr_053_jspservlet.html
> 
> But I can't read this document.(I'm not JCP member.)
> 
> I'm interested in these problem.
> Could I join discussion?
> Must I wait "Proposed Final Draft" ?

To work with the specs you must become a JCP member. I think it's too late
to join JSR-053, but I may be wrong. Check with Eduardo:

  Eduardo Pelegri-Llopart <pe...@eng.sun.com>

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com

Re: [PATCH] International Problem with getParameter()

Posted by Takashi Okamoto <to...@rd.nttdata.co.jp>.
Hans wrote:

> I'm afraid this patch has no support in the Servlet 2.2 specification.
> A similar solution is being discussed for Servlet 2.3, but to me it
> seems like IBM WebSphere (3.0) and Caucho Resin are doing things that
> are not in line with the current spec.

I see.
I found Servlet 2.3 document.
http://java.sun.com/aboutJava/communityprocess/jsr/jsr_053_jspservlet.html

But I can't read this document.(I'm not JCP member.)

I'm interested in these problem.
Could I join discussion?
Must I wait "Proposed Final Draft" ?
-------------------------------------------------
NTTDATA Corporation, R&D Headquarters
Takashi Okamoto (mailto:tokamoto@rd.nttdata.co.jp)



Re: [PATCH] International Problem with getParameter()

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Takashi Okamoto wrote:
> 
> Hello ,Tomcat developers.
> 
> I made a patch for 'resolve international problem' in tomcat 3.2b2.
> 
> [caution!!] Under English environment, you can't affirmation this
>             problem.
>      Japanese ,Korean ,Chinese ,etc.. not English people have
>             this problem!!
> 
> This problem exists at 'getParameters()' in
> 'org/apache/tomcat/core/RequestImpl.java'.
> 
> getParameters() don't decode character encodings automatically.
> We (not English people) avoid this problem to write next code
> 
> --------
> response.setContentType("text/html;charset=EUC_JP");
> String str = request.getParameter("PARAM_NAME");
> String decode_str = null;
> if(str!=null){
>   decode_str = new String(str.getBytes("8859_1") ,"EUC_JP");
>   str=decode_str;
> }
> --------
> This is EUC_JP(Japanese code) example.
> But EUC_KR(Korea),EUC_CN(Chinese)..etc  have same problem too!!
> 
> But IBM WebSphere (3.0) and Caucho Resin don't have this problem.
> They decode character encodings automatically.
> and we write only:
> 
> --------
> response.setContentType("text/html;charset=EUC_JP");
> String str = request.getParameter("PARAM_NAME");
> --------
> 
> If we apply this patch to tomcat 3.2b2 ,we are grad that we don't need
> decode character encoding manually.
> 
> Could you apply this patch on next release?

I'm afraid this patch has no support in the Servlet 2.2 specification.
A similar solution is being discussed for Servlet 2.3, but to me it
seems like IBM WebSphere (3.0) and Caucho Resin are doing things that
are not in line with the current spec.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com