?
Solved

Querystring corruption with Netscape 7.0 in showDocument(URL)

Posted on 2003-03-14
15
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

765 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