sindresorhus / query-string

Parse and stringify URL query strings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is strict-uri-encode really necessary?

wmertens opened this issue · comments

I am using https://github.com/Sage/jsurl to efficiently encode JSON objects in the search string, and it uses the looser URI encoding range used by browsers, including the ' character.

I also use rackt/history which uses query-string, which converts ' to %27, which grows my urls, which makes me sad. Is there a reason the strict URI range should be used?

It was introduced in #29.

// @go-oleg @kevva

Aww :-(

How about putting strict mode behind a flag?

On Thu, Dec 10, 2015, 6:19 PM Sindre Sorhus notifications@github.com
wrote:

It was introduced in #29
#29.

// @go-oleg https://github.com/go-oleg @kevva https://github.com/kevva


Reply to this email directly or view it on GitHub
#42 (comment)
.

Wout.
(typed on mobile, excuse terseness)

Maybe it's browser support related? Not sure though, just guessing here.

@SamVerschueren the reason for #29 afaict was that markdown parsers were parsing urls with strict interpretation of the relevant RFCs which caused URLs to not be completely linkified.

IMHO the markdown parser should be fixed, because markdown is a loose format that needs to be generous regarding its inputs. After all, anybody can copy a URL from a browser and it will have the looser URI character range.

So I would be really happy if query-string could revert its ways and make the behavior in #29 optional…

I'm willing to put it behind an option if anyone does a good pull request with tests and docs, but it should be strict by default.

<3 thanks @SamVerschueren! Now to get rackt/history to do the same :)