Re: [whatwg/encoding] Fast byteLength() (Issue #333)

I'm a little worried about offering this API as it encourages decoupling the length from the data which can have all kinds of unintended consequences.

Bad legacy APIs such as `Content-Length` are a reasonable use case though.

We'd only support UTF-8 and as such it also seems like it would be quite straightforward (modulo surrogates) to implement this API yourself in script as you did. Still, we might as well expose it.

(I also considered prefixing with `unsafe` due to the bad nature of the API, but I can't quite convince myself it's that bad. An instance `long long byteLength(DOMString input)` method seems reasonable enough.)

cc @mathiasbynens @hsivonen 

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

Message ID: <whatwg/encoding/issues/333/2283856615@github.com>

Received on Monday, 12 August 2024 12:36:07 UTC