Anonymous | Login | Signup for a new account | 05-17-2024 00:53 PDT |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0000667 | [Resin] | minor | always | 01-04-06 04:41 | 01-30-06 16:26 | ||||
Reporter | scud | View Status | public | ||||||
Assigned To | ferg | ||||||||
Priority | normal | Resolution | unable to reproduce | ||||||
Status | closed | Product Version | 3.0.14 | ||||||
Summary | 0000667: getRequestURI problem | ||||||||
Description |
I have a simple jsp page to use getRequestURI,but in different environment,got different result. the page is: --------------------------------------------------- <%@ page contentType="text/html; charset=UTF-8"%> <html> <head> <title>My JSP 'testuri.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> </head> <body> This is my JSP page. <% String para1 = request.getParameter("para1"); System.out.println("para1:" + para1); String uri = request.getRequestURI(); System.out.println("uri:" + uri); String parauri = uri.substring(uri.lastIndexOf('/') + 1); System.out.println("parauri:" + parauri); String decode = java.net.URLDecoder.decode(parauri,"UTF-8"); System.out.println("urldecode:" + decode); String last3 = new String(decode.getBytes("ISO-8859-1"),"UTF-8"); System.out.println("last3:" + last3); %> para1:<%=para1%> uri:<%=uri%> parauri:<%=parauri %> decode:<%= decode %> last3:<%= last3 %> </body> </html> --------------------------------------------------- the web.xml is like: --------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" [^] xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^] xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee [^] http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> [^] <servlet> <servlet-name>testuri</servlet-name> <jsp-file>/testuri.jsp</jsp-file> </servlet> <servlet-mapping> <servlet-name>testuri</servlet-name> <url-pattern>/testuri/*</url-pattern> </servlet-mapping> </web-app> --------------------------------------------------- in my windows 2000 professional chinese (GB2312 encode ),resin 3.0.14 pro : start with httpd -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en: I visist: http://localhost:8080/webtest/testuri//%E4%B8%AD [^] result : ------------------------------ para1:null uri:/webtest/testuri//%E4%B8%AD parauri:%E4%B8%AD decode:&20013; last3:? ------------------------------ all are fine,got expected result. (not decode by resin ) but in my server redhat linux as4.2 ,en_US.UTF-8 ,resin 3.0.14 http://test.javascud.com/testuri/%E4%B8%AD [^] i got: ------------------------------ para1:null uri:/testuri/中 parauri:中 decode:中 last:中 last2:中 last3:&20013; ------------------------------ yes,it it wront result. seem it was decode with "ISO-8859-1" automatic,but my encode is UTF-8,so i get the wront result. how to solve? thank you |
||||||||
Additional Information | redhat AS4 ,en_US.UTF-8 | ||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
33 total queries executed. 27 unique queries executed. |