How To Access A File Name Containing URL Encoding Through The Browser?
Solution 1:
The %20
that you use in the URL will be decoded, so you are looking for the file " .txt"
, but the %20
that you used to create the file is not decoded, so the actual name of the file is "%20%20.txt"
.
You need to use the URL http://mysite/%2520%2520.txt
to access the file "%20%20.txt"
. The %25
is the encoded form of %
.
Solution 2:
Use %2520%2520.txt
, %25
decodes as the percent-sign %
. You can use the table on http://www.asciitable.com/. The number after the percent-sign is a hexadecimal representation of the ASCII value.
If you have a long string, you could also use Javascript's encodeURIComponent
function:
prompt("Encoded:", encodeURIComponent("%20%20.txt"))
This could be executed in the Javascript console (Ctrl + Shift + J in Firefox) and displays a dialog containing the escape value.
Solution 3:
If your file name really is %20%20.txt
, try http://yoursite.com/%2520%2520.txt.
%25 is the percentage encoded.
Solution 4:
You need to escape those percent signs:
http://mysite/%2520%2520.txt
Post a Comment for "How To Access A File Name Containing URL Encoding Through The Browser?"