RE: escape() Problem...

2001-03-16 Thread Wouter Boers

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




RE: escape() Problem...

2001-03-16 Thread Martin Ko

Thanks, Wouter

M$ IE javascripting engine is working differently from NS js engine.
That is, in NS, escape function returns uri encoded string by *%CF%DF* format,
but in IE, escape function returns by *%uABCD* unicode format, and this 
lead to decode error in apache web server.
Yes, to use java.net.URLDecorder.encode() is an only way to solve this problem.

Thanks again.
Martin

At 03:54  2001-03-16 +0100, you wrote:
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" %

javascript:test()Test

--
%=request.getParameter("t1")%

Regards
Martin