question

The asker of this question selected no best answer.

answers (3)

gymclothes
0
Votes
gymclothes  |  December 15, 2008 10:37 PM
Can you provide some of the code?
Comment
tlivings
tlivings  |  December 15, 2008 10:56 PM
Literally something to the affect of:
myURL = serverPrefix+"arg?"+someArg;

That URL, when launching in the browser (though the mouseover looks fine) will actually open with %3F for the "?" character - result is a bad link.
gymclothes
gymclothes  |  December 15, 2008 11:13 PM
Usually, when you are hard coding the "?" it would not be affected by encoding errors such as being displayed as %3F.

Before you print out the variable myURL, have you tried running it through URLDecode? Try taking a look at java.net.URLDecoder - http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLDecoder.html

The expression would be "java.net.URLDecoder.decode(myURL)" to decode the string.
ilaksh
ilaksh  |  December 16, 2008 02:53 AM
Based on the code posted I believe the problem is the specific manner in which the URL is "launching in the browser". What does the HTML output look like when you view the HTML source in the browser for the generated page? Specifically what is in the HREF= attribute?
Also just in case can you tell us what browser you are using?
Also if you could provide just a little more code specifically to provide more details related to the way in which myURL becomes part of the rendered page that may help.
tlivings
tlivings  |  December 16, 2008 04:09 AM
@gymclothes Hmm, some things worth trying since it is clearly an encoding problem.
@ilaksh This occurs on all browsers but only on AIX servers. Other systems do not exhibit this particular problem.
ilaksh
ilaksh  |  December 16, 2008 05:15 AM
That's interesting it only happens on aix servers. Can you answer my other questions like what is in the href= attribute?
Also one thought is, what if this isn't actually related to the ? mark but its some other text that is the problem.. maybe one server is case sensitive and another is not.
tlivings
tlivings  |  December 16, 2008 08:08 PM
@gymclothes I was hoping the URLDecoder would in fact fix this problem (it seemed reasonable) but I think it is more likely something occurring later (not when I am storing the url).

@ilaksh There isn't actually an HREF - this is a URL stored in a DB and being grabbed out later. Once again entirely environmental to AIX.

I'm thinking this is something I am going to have to investigate outside of Java - such as the DB encoding.
gymclothes
gymclothes  |  December 16, 2008 08:19 PM
Could you show us the code that you are using to print out the myURL variable? and maybe how you tried to use the URLdecode? You should use the URLdecode right at the time when you are printing the url to the href="" part of the code.

Whatever the problem is causing this "%3F" replace, you should be able to do a string replace right before you print the variable.

I wish I could help more, but my knowledge of AIX servers is limited.
spachev
0
Votes
spachev  |  December 15, 2008 10:44 PM
Check the documentation to see if you can turn off URL escaping. Or is if there an API that allows you to construct a URL from components.
Comment
ilaksh
0
Votes
ilaksh  |  December 15, 2008 10:56 PM
Try replacing the ? in the hard coded url with %3F.
Or, if your URL look like this http://www.domain.com/blah.jsp?query=test (with the only ? coming after blah.jsp)
then link is correct and there is something wrong with your software. The ? is a reserved character that indicates that parameter values follow.
Comment
140

ask any question

Top of Page
Buy Mahalo Dollars
WITH CREDIT CARD OR PAYPAL

Please log in to use this function.