Hi,
Don't rely in JavaScript.
Use java.net.URLDecoder.encode(), and java.net.URLEncoder.decode() before
you push the parameters to the browser.
Wouter
-----Original Message-----
From: Martin Ko [mailto:[EMAIL PROTECTED]]
Sent: 16 March 2001 14:52
To: [EMAIL PROTECTED]
Subject: escape() Problem...
Hi, all.
I wrote a jsp page which send request by QUERYSTRING with a parameter
containing international characters, and which get the parameter.
I'm working with apache as a web server and tomcat as a jsp engine.
And, with Netscape browser, I encode the string by escape function
(javascript) before sending it, and it works fine. However, in IE, it
doesn't.
When I use only tomcat as a web server without apache, I saw a strange
thing.
In this case, if I use escape function in NS, and if I don't use escape
function in IE, then it goes well !!
But with apache as a web server, this action does not solve the problem...
So, I think I should set some configurations on apache web server, but I
have no idea...
Can anyone help me?
My jsp page is:
<%@ page language="java" %>
<html>
<head>
<title></title>
<script>
<!--
function myEscape(s)
{
if (document.all) { // when IE
return s;
} else { // when Netscape
return escape(s);
}
}
function test()
{
var s = prompt("Enter text: ");
var url = "martin.jsp?t1=" + myEscape(s);
alert(url);
location.href = url;
}
//-->
</script>
</head>
<body>
<a href="javascript:test()">Test</a>
<HR>
<%=request.getParameter("t1")%>
</body>
</html>
Regards
Martin