tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takashi Okamoto" <tokam...@rd.nttdata.co.jp>
Subject [PATCH] International Problem with getParameter()
Date Mon, 07 Aug 2000 01:25:28 GMT
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)


Mime
View raw message