troch / path-parser

A small utility to parse paths.
MIT License
140 stars 24 forks source link

Option to treat plus signs (+) as spaces #66

Open yndx-madfriend opened 1 year ago

yndx-madfriend commented 1 year ago

It is common to use literal plus sign in query string as a synonym of space, and many websites support this: https://google.com?q=foo+bar.

The w3c spec says:

Within the query string, the plus sign is reserved as shorthand notation for a space. Therefore, real plus signs must be encoded. This method was used to make query URIs easier to pass in systems which did not allow spaces.

However, there is a debate whether url encoding / decoding should treat plus signs this way, see https://stackoverflow.com/questions/5450190/how-to-encode-the-plus-symbol-in-a-url.

Can path-parser (and router5) have an option to enable such encoding/decoding of plus signs?