views:

103

answers:

2

I noticed an issue where with the following HTML:

<html>
    <head>
        <title>UrlEncode Test</title>
    </head>
    <body>
        <a href="http://example.com/Process.php?OrderID=y%2bog%3d"&gt;Process&lt;/a&gt;
    </body>
</html>

Instead of replacing %2b with +, Firefox does so with a space instead so that clicking on the link tries to navigate to "http://example.com/Process.php?OrderID=y og=" instead of "http://example.com/Process.php?OrderID=y+og=". IE and Chrome has no problems with this at all; just Firefox. Has anybody else encountered this and was able to workaround it?

A: 

You're running into an issue with URL Encoding.

In your case, I would suggest forming the url like this:

http://example.com/Process.php?OrderID=y+bog%3d

Since it seems as if you intend to actually use the "+" symbol in that fashion. There's no problem with having a "+" symbol in your url.

Joseph
The problem is that the URL may be generated by PHP's urlencode(), ASP.NET's HttpUtility.UrlEncode() or Python's urllib.quote(), so "+" in the original string will become "%2b".
Bullines
A: 

So I saved the code you offered in a local HTML file, opened it in Firefox 3.5 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5), hovered the link (saw "y+og" in the status bar), clicked it and the location bar contained http://example.com/Process.php?OrderID=y%2bog%3d. Can you actually reproduce the problem with your example? What Firefox version on what OS? Exact steps to reproduce?

Nickolay
The steps I use are to save a local file using the HTML above and open it in Firefox 3.5 on Windows Vista.
Bullines
And then? What did you see when hovering the link? When clicking it? My guess is that it could be related to the regional settings and/or character encoding settings in Firefox.
Nickolay