tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DonS, Choi" <dsc...@dreami.co.kr>
Subject Re: Multi byte language problem in request.getParameter()
Date Mon, 27 Mar 2000 18:22:21 GMT
I made a simple jsp code(call it paramtest.jsp)

<%  String a = request.getParameter("name");
        out.print(a);
%>

Case 1)  when i connect http://a.com/paramtest.jsp?name=ㄹㄹ
Apache log file(/usr/local/apache/logs/access_log) shows
...
[23/May/2000:21:56:39 +0900] "GET /startupclass/paramtest.jsp?name=ㄹㄹ HTTP/1.1" 200 154
....

But tomcat log file($TOMCAT_HOME/logs/jasper.log) shows
....
<JASPER_LOG> Tue May 23 21:58:01 GMT+09:00 2000               RequestURI: /startupclass/paramtest.jsp</JASPER_LOG>
<JASPER_LOG> Tue May 23 21:58:01 GMT+09:00 2000              QueryString: name=</JASPER_LOG>
<JASPER_LOG> Tue May 23 21:58:01 GMT+09:00 2000           Request Params: </JASPER_LOG>
<JASPER_LOG> Tue May 23 21:58:01 GMT+09:00 2000                  name = </JASPER_LOG>
<JASPER_LOG> Tue May 23 21:58:01 GMT+09:00 2000 Classpath according to the Servlet Engine
is: /usr/local/apache/htdocs/
WEB-INF/classes</JASPER_LOG>
....

As you can see , In tomcat log file, there is no QueryString

Case 2) when i connect http:8080//a.com/paramtest.jsp?name=ㄹㄹ
tomcat log file shows
...
<JASPER_LOG> Tue May 23 22:01:36 GMT+09:00 2000               RequestURI: /startupclass/paramtest.jsp</JASPER_LOG>
<JASPER_LOG> Tue May 23 22:01:36 GMT+09:00 2000              QueryString: name=¤?¤?</JASPER_LOG>
<JASPER_LOG> Tue May 23 22:01:36 GMT+09:00 2000           Request Params: </JASPER_LOG>
<JASPER_LOG> Tue May 23 22:01:36 GMT+09:00 2000                  name = ¤?¤?</JASPER_LOG>
<JASPER_LOG> Tue May 23 22:01:36 GMT+09:00 2000 Classpath according to the Servlet Engine
is: /usr/local/apache/htdocs/startupclass/
WEB-INF/classes</JASPER_LOG>
.....

As you can see, Although QueryString is broken, tomcat can accept QueryString. 

Why tomcat can't accept non-ascii parameter?


----- Original Message ----- 
From: <ed@apache.org>
To: <tomcat-dev@jakarta.apache.org>
Sent: Tuesday, May 23, 2000 1:19 PM
Subject: Re: Multi byte language problem in request.getParameter()


> On Mon, 27 Mar 2000, DonS, Choi wrote:
> 
> > I have a following code
> > 
> > -----------------------------------------
> > ..
> > <script>
> > function search_winner(name)
> > {
> >  location.href= 'e_winner.jsp?sid=' + sid + '&name=' + name;
> > };
> > </script>
> > .....
> > -----------------------------------------------------------------------
> > In above sample code "name" is 2-byte lanaguage (non-ASCII)
> > So tomcat should handle  URL  http://e_winner.jsp?sid=0000&name=??
> > 
> > In weblogic(our company uses weblogic), there is no problem.
> > Weblogic can handle 2-byte lanuage in URL.
> > 
> > Is there any solution?
> 
> Questions like this belong on tomcat-users.
> 
> The code you've shown is quite broken -- you need to encode name when you
> use it in an URL like this.  Use the output of
> java.net.URLEncoder.encode(name) -- instead of name -- and you should be
> fine.
> 
> I don't know enough about the internals of WebLogic to speculate as to why
> it may work in that environment -- but this code should be fixed in any
> case.  FWIW -- you might also want to apply response.encodeUrl to the
> whole url, so as to allow sessions to work when users turn off cookies.
> 
> Ed
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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