URL Encoder not working in Netscape

Hi All,

I am using url encoding in my servlet for redirecting a request. The query string values has some spaces in them. The code I have used is shown below

String mname = "Jason Perry"

response.sendRedirect

("http://194.216.8.238:8081/merchant/merch.merchant?msgid=RP&mctid=1111242&totcp="+price.toString()+"&mname="+URLEncoder.encode(mname)+"&mtxnid=UY675432");

Please note that 194.216.8.238:8081 is an IP of another server located outside our network.

In Netscape the url is shown as http://194.216.8.238:8081/merchant/merch.merchant?msgid=RP&mctid=1111242&totcp=15

&mname=Jason Perry&mtxnid=UY675432

The space is not getting replaced with the plus.

But I have observed that if the redirection is to the same server on which the servlet is running, it works fine.

I am at loss as to why url encode is not working when routing the request to another server. I am using Netscape 4.77 .

This is works in IE fine.

Your inputs are appreciated.

Thanks

Malini

[1138 byte] By [malini_nagaraj] at [2007-9-26 1:47:59]
# 1

Yeah had this problem before, use the java.net.URLEncoder class:

<%@ page language="java" import="java.net.URLEncoder"%>

<%

String url = "http://194.216.8.238:8081/merchant/merch.merchant?msgid=RP&mctid=1111242&totcp=15

&mname=Jason Perry&mtxnid=UY675432"

String encodedUrl = URLEncoder.encode(url);

response.sendRedirect(encodedUrl);

%>

Enygma42 at 2007-6-29 2:47:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Oops sorry, didn't see that you were already using it!
Enygma42 at 2007-6-29 2:47:42 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...