Re: [encoding] Benefits of "Legacy" Encodings – Byte Counter (#4)

@mathiasbynens, thanks for the reply. Do you mean st like `myTextarea.value.length`, please? If I understand it correctly this does not work – JavaScript converts the string to UTF-16, so the `.length` represents only the number of UTF-16 code units. The measurement could be done on a byte stream, but I do not know how to obtain it – it cannot be done via `(new TextEncoder('big5')).encode(myTextarea.value)` because of the UTF exclusivity.

The libraries looks very nice, I will examine them. A native solution would be still better – I need a support for tens of encodings, even the multi-byte ones – that would require megabytes of libraries, which is not very elegant for such a simple task as byte counting.

(The counter page by itself is in UTF-8 – the final text encoding can be set independently.)

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/4#issuecomment-103578724

Received on Tuesday, 19 May 2015 16:26:24 UTC