Sometimes the spaces get URL encoded to the +
sign, some other times to %20
. What is the difference and why should this happen?
What's the difference: See other answers.
When use +
instead of %20
? Use +
if, for some reason, you want to make the URL query string (?.....
) or hash fragment (#....
) more readable. Example: You can actually read this:
https://www.google.se/#q=google+doesn%27t+encode+:+and+uses+%2B+instead+of+spaces
(%2B
= +)
But the following is a lot harder to read: (at least to me)
https://www.google.se/#q=google%20doesn%27t%20oops%20:%20%20this%20text%20%2B%20is%20different%20spaces
I would think +
is unlikely to break anything, since Google uses +
(see the 1st link above) and they've probably thought about this. I'm going to use +
myself just because readable + Google thinks it's OK.