On the use of %20 instead of + in URIs

On 11/27/20 11:10 AM, Philip Linde wrote:
> "+" doesn't generally have a special meaning that implies synonymity
> with spaces. The sentence you're referring to should be considered a
> clarifying point (because it's an easy mistake to make I guess), not a
> difference from the standard it adopts (RFC 3986)

Philip is correct, but to add on, the '+' specifically has a semantic 
meaning as a space in query strings and form encodings 
(application/x-www-form-urlencoded) according to RFC 1866, but NOT in the 
rest of the URL itself. If you have a URL library that is parsing +'s as 
spaces in the URL outside of a query string, that library is incorrect. 
Only %20 is valid as a space in that context.

+ signs are listed as a sub-delimiter (RFC 3986 Section 2.2) and part of 
the reserved character set, meaning they should be encoded if not doing so 
would create confusion in the URL schema. Encoding a + sign would be %2B. 
You're welcome to do that if you want to avoid confusion, but it really 
shouldn't be necessary.

---

Previous in thread (3 of 7): 🗣️ Philip Linde (linde.philip (a) gmail.com)

Next in thread (5 of 7): 🗣️ Adnan Maolood (me (a) adnano.co)

View entire thread.