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

windows-1250 and koi8-u are listed in the spec as _legacy single-byte encodings_, so assuming the input is valid (i.e. can be represented in that encoding), you can just get its `.length` to count the bytes. 

Alternatively, use a library that implements the encoding you need (e.g. https://github.com/mathiasbynens/windows-1250 for windows-1250; see https://www.npmjs.com/browse/keyword/legacy-encoding for the full list of single-byte legacy encodings) and use `input.encode().length`.

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

Received on Tuesday, 19 May 2015 14:22:27 UTC