Re: [whatwg/url] Add a note that `searchParams` is not unicode-aware (#596)

@TimothyGu Hmm OK.

That is actually what I'm doing for Swift - offering both the JS model defined in the standard and one which I think better suits the expectations of Swift developers (for instance, the setters in the JS model allow extra data which gets silently dropped, filters tabs and newlines, etc. It's rare that strings in Swift contain extra content that is not deliberate, so that behaviour is only exposed via the JS model).

I am a bit worried about possibly having too much divergence; URLs are complex enough, and having every URL library invent new behaviours will increase the cognitive burden for developers, open the door for bugs when the differences are subtle (like this), and generally is not good for developers wanting to write portable code or compose a system from components written in multiple languages. I agree that documentation is vital (I actually noticed this issue while improving the docs, wondering what it means for a key to "match").

There are broader issues with this, anyway. I recently helped a developer who was frustrated that requests to a Hungarian dictionary website wouldn't recognise the word encoded in his URL's query (in the _value_ part of a key-value pair), and thought the language/library was to blame. As it turns out, the website wasn't NFC-normalising the string before looking it up in its database - so this isn't limited to keys, or even to URLs. I suppose in a perfect world, everything from your URL libraries to your databases would use Unicode-aware comparisons across the board. Maybe one day...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/596#issuecomment-830444330

Received on Friday, 30 April 2021 22:57:52 UTC