Link to home
Start Free TrialLog in
Avatar of HanRui
HanRui

asked on

Querystring corruption with Netscape 7.0 in showDocument(URL)

I have a querystring that I send to a shell script with showDocument(). A perl script writes the string to an html file. I have embedded tags in the string, such as <BR>. The tags work when the string is sent with IE 6 or Netscape 4.7. With Netscape 7.0, the <BR> tag comes out written as %3CBR%3 in the HTML file. A println check in the code outputs the correct string to the java console. Anybody know why 7.0 VM does that? Is there a fix? I like the format in the HTML file because it is printing data collected in an Applet.
Avatar of Mick Barry
Mick Barry
Flag of Australia image

NS uses the Sun VM.
Can you post the relevant parts of your code.
Sounds like you may need to use the URLEncoder to encode the query string, and then decode it before displaying it.
Avatar of HanRui
HanRui

ASKER

I do send all input strings to URLEncoder. Also, the code does work with NS 4.7 but not with NS 7.0.

String toShow= "TEXT_ID_" + "_=_" + userID+"<BR>"
+ "TEXT_Errors_=_" + Integer.toString(textErrors)+"<BR>"
+ "TEXT_Clear_=_" + Integer.toString(textClear)+"<BR>"
+"_Start_=_" + startTime
+"<BR>"+"_Stop_=_" + endTime +"<BR>";
> I do send all input strings to URLEncoder

And does your perl script decode it?

> Also, the code does work with NS 4.7 but not with NS 7.0.

Yes they use different VM's.
What is the value of URLEncoder.encode(toShow) on 4.7?
Avatar of HanRui

ASKER

TEXT_ID__=_me<BR>TEXT_Errors_=_0<BR>TEXT_Clear_=_0<BR>_Start_=_Mar_14,_2003_8_21_06_PM<BR>_Stop_=_Mar_14,_2003_8_21_48_PM<BR>

Above is one that I just did with NS 7.0. java console.

Below is what came out in the HTML file for the <BR> tag.
It works ok in NS 4.7 and IE 6.

130.85.97.169<BR>TEXT_ID__=_me%3CBR%3ETEXT_Errors_=_0%3CBR%3ETEXT_Clear_=_0%3CBR%3E$
> TEXT_ID__=_me<BR>TEXT_Errors_=_0<BR>TEXT_Clear_=_0<BR>_Start_=_Mar_14,_2003_8_21_06_PM<BR>_Stop_=_Mar_14,_2003_8_21_48_PM<BR>

> Above is one that I just did with NS 7.0. java console.

That does not appear to have been encoded.
And does your perl script decode it?
What is the value of URLEncoder.encode(toShow) on NS4.7?
What is the value of URLEncoder.encode(toShow) on NS7?

Avatar of HanRui

ASKER

The variables are encoded before they are concatenated in the toShow string. There are no spaces in the string for the encoder to substitute a +. All the perl script does is write the querystring to the html file. It works fine with IE 6 and NS 4.7. It produces the %... with NS 7. The problem is NS 7, and I'm not sure how to handle that.
> The variables are encoded before they are concatenated in the toShow string.

Yes and can you post the encoded strings to see what is going on :)

> There are no spaces in the string

The encoder does more than just change space.

> All the perl script does is write the querystring to the html file.

If your applet is encoding it, then the perl needs to decode it.

> It produces the %... with NS 7.

That is in fact the correct encoding.
< -> %3C
> -> %3E

Avatar of HanRui

ASKER

I'll try encoding the whole string. What still does not make sense to me is that it works with NS 4.7 and IE 6. So I don't think I understand the symbolic encodings and why they should differ between NS 7 and NS 4.7.
> I'll try encoding the whole string.

What were you encoding previously??

> why they should differ between NS 7 and NS 4.7.

Thats why I have (repeatedly) asked you to post the encoded string from both.
It could be related to the browser and not the vm.
Avatar of HanRui

ASKER

I did post them. They both come out exactly the same in the java console. The only difference appears in the HTML file. With NS 7, the 3-char codes appear in the HTML file, but not in the Java console. I have been looking at the URLDecode.decode() and URLEncode.encode() methods, and I don't see a solution. I'm trying decode, but I'm having trouble with the try-catch. I need some sleep. Thanks for your help with this so far. It look likes NS 7 is transmitting the 3-char codes without sending them to a method.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HanRui

ASKER

Thanks. I have to do the transition in the perl script.