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.
Sounds like you may need to use the URLEncoder to encode the query string, and then decode it before displaying it.
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(textError s)+"<BR>"
+ "TEXT_Clear_=_" + Integer.toString(textClear )+"<BR>"
+"_Start_=_" + startTime
+"<BR>"+"_Stop_=_" + endTime +"<BR>";
String toShow= "TEXT_ID_" + "_=_" + userID+"<BR>"
+ "TEXT_Errors_=_" + Integer.toString(textError
+ "TEXT_Clear_=_" + Integer.toString(textClear
+"_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?
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?
ASKER
TEXT_ID__=_me<BR>TEXT_Erro rs_=_0<BR> TEXT_Clear _=_0<BR>_S tart_=_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_Err ors_=_0%3C BR%3ETEXT_ Clear_=_0% 3CBR%3E$
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__
> TEXT_ID__=_me<BR>TEXT_Erro rs_=_0<BR> TEXT_Clear _=_0<BR>_S tart_=_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.
> 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?
What is the value of URLEncoder.encode(toShow) on NS4.7?
What is the value of URLEncoder.encode(toShow) on NS7?
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
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
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.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. I have to do the transition in the perl script.
:-)
Can you post the relevant parts of your code.