Re: [whatwg/encoding] Consider adding TextEncoder.containsLoneSurrogates() static (#174)

> So I would say that that is a bug in the producer, since they should have never created an invalid string in the first place.

Maybe, but pointing elsewhere doesn't exactly make debugging any easier (rather proves my point that, in the absence of a checked API, the debugging of such cases and finding out the root cause can quickly become a hell).

> I think I'm convinced that adding this to String in some manner is the way to go if it's needed.

I don't mind moving this to `String` land.

It's just `TextEncoder` seemed like the best place given that it's currently the central point for dealing with string encoding and, as mentioned above, already has a very similar API and mechanism in the opposite direction.

At the same time, JS on its own doesn't care about interop with external APIs and works well with lone surrogates in all built-in APIs.

-- 
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/encoding/issues/174#issuecomment-480937098

Received on Monday, 8 April 2019 17:54:55 UTC