I'm trying to debug a function which decodes URL strings. For example the string file:///C:/some%20filename would get changed to file:///C:/some filename
As expected, the function has replaced "%20" with a space character. For reasons I don't understand though, the function also removes '+' characters from the URL - so file:///C:/some+filename also gets changed to file:///C:/some filename (with the '+' character getting replaced by a space). Would this be normal behaviour for a URL decoder? I didn't think that '+' was special or illegal in any way.
"A problem well stated is a problem half solved.” - Charles F. Kettering
Thanks for the suggestion Jacob. To be honest I'm happy enough with the provided code - except for being confused about why it filters out '+' characters and replaces with space characters. I know that certain characters are special in URLs (such as '%') but AFAIK the '+' character is just a normal character, like 'a', 'b' or 'c'. Unless somebody knows different...
"A problem well stated is a problem half solved.” - Charles F. Kettering
The + sign is another way to encode spaces in urls. It is normally used in query strings - you can see this by typing a few words into google and seeing the url it creates for the results page.
If a + sign is actually needed in a url it can be, but must be encoded, as %2B.
Bookmarks