Eric Leschinski Eric Leschinski - 2 years ago 884
HTML Question

A html space is showing as %2520 instead of %20

Passing a filename to the firefox browser causes it to replace spaces with

instead of

I have the following HTML in a file called

<img src="C:\Documents and Settings\screenshots\Image01.png"/>

When I load
into firefox, the image shows up as a broken image. So I right click the link to view the picture and it shows this modified URL:

^-----Firefox changed my space to %2520.

What the heck? It converted my space into a
. Shouldn't it be converting it to a

How do I change this HTML file so that the browser can find my image? What's going on here?

Answer Source

A bit of explaining as to what that %2520 is :

The common space character is encoded as %20 as you noted yourself. The % character is encoded as %25.

The way you get %2520 is when your url already has a %20 in it, and gets urlencoded again, which transforms the %20 to %2520.

Are you (or any framework you might be using) double encoding characters?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download