?
Solved

Querystring corruption with Netscape 7.0 in showDocument(URL)

Posted on 2003-03-14
15
Medium Priority
?
181 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:HanRui
  • 9
  • 6
15 Comments
 
LVL 92

Expert Comment

by:objects
ID: 8140617
NS uses the Sun VM.
Can you post the relevant parts of your code.
0
 
LVL 92

Expert Comment

by:objects
ID: 8140628
Sounds like you may need to use the URLEncoder to encode the query string, and then decode it before displaying it.
0
 

Author Comment

by:HanRui
ID: 8140639
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>";
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 92

Expert Comment

by:objects
ID: 8140669
> 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?
0
 

Author Comment

by:HanRui
ID: 8140706
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$
0
 
LVL 92

Expert Comment

by:objects
ID: 8140733
> 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.
0
 
LVL 92

Expert Comment

by:objects
ID: 8140747
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?

0
 

Author Comment

by:HanRui
ID: 8140773
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 8140988
> 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

0
 

Author Comment

by:HanRui
ID: 8141235
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 8141304
> 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.
0
 

Author Comment

by:HanRui
ID: 8141348
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.
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 8141385
> I did post them.

Then you are not encoding them.

> I don't see a solution. I'm trying decode

They need to be encoded, *not* decoded.

It appears that you are not encoding them at all, which you should be. The reason that NS7 works I suspect is because it is correctly encoding them for you.

To solve your problem you need to change your perl script to correctly decode the string.


0
 

Author Comment

by:HanRui
ID: 8142301
Thanks. I have to do the transition in the perl script.
0
 
LVL 92

Expert Comment

by:objects
ID: 8144658
:-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question