Jump to content

URL encoding


Guest allen_ravi

Recommended Posts

Guest allen_ravi

I am sending a part a of the URl as encoded, as the following URI http://localhost/samual/ram/http:%2f%2fram%2sampam this URL return error message reporting 404 file not found.instead of using this , ie "/" %2f if i go for something else its work fine , how could fix this.. siince i have use the / ie encoded into %2f is their any way to resolve this.. please help ....

Link to comment
Share on other sites

Um... where exactly is this supposed to lead to? No file can have "/" in it's real name or ":" for that matter. If this is supposed to be a name or a value of a variable, you need to either escape the ":" or better yet, add a variable name and put this adress as a value. Anyhow, unless you say where is this supposed to lead to, it's all subjective.

Link to comment
Share on other sites

%20 is the URL encoded space. Solocalhost/my%20file.htmlis the equivalent of the file pathc:\htdocs\my file.htmlif we suppose the documentRoot is at c:\htdocs of course.

Link to comment
Share on other sites

The same as HTML entities: to include characters that are otherwise illegal in the context.For example, a space is not allowed in a URL, but it is allowed in file names. So in order to select a file that has a space in it's name, you need some way to write a space in a URL. The "%20" ANSI code indicates a space.See the URL Encode page for other ANSI code references and for a text box, allowing you to see the URL encoded equivalent.

Link to comment
Share on other sites

URL encoding uses a % sign followed by 2 hex characters, which denote the hex value of the ASCII character to use. Since 0x2F corresponds to ASCII character 47, which turns out to be /, it works fine. The problem with this:http://localhost/samual/ram/http:%2f%2fram%2sampamis the end, the %2s. That is not a valid hex value.Regardless, you might want to think about usage. If we assume the %2s should be %2f, then you are giving the browser this URL:http://localhost/samual/ram/http://ram/ampamDoes that really correspond to an actual filename? Because I don't see how it can. In order for that to work, you would need a file named "http://ram/ampam" located in the /samual/ram directory. And, I know you can't have a file by that name because the slash is not a valid character for a filename.So, the 404 message is correct. The server has no clue what you are asking for. If you want that URL to be sent as a querystring parameter to the index page in the ram directory, then you need a question mark before it. But, even so, that would be the name for a querystring variable, not a value.So.. what exactly are you trying to do?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...