Polyfill for the Encoding Living Standard's API
Polyfill for the Encoding Living Standard's API
This is a polyfill for the Encoding Living Standard API for the Web, allowing encoding and decoding of textual data to and from Typed Array buffers for binary data in JavaScript.
By default it adheres to the spec and does not support encoding to legacy encodings, only decoding. It is also implemented to match the specification's algorithms, rather than for performance. The intended use is within Web pages, so it has no dependency on server frameworks or particular module schemes.
Basic examples and tests are included.
There are a few ways you can get and use the text-encoding library.
Clone the repo and include the files directly:
This is the only use case the developer cares about. If you want those fancy module and/or package manager things that are popular these days you should probably use a different library.
The package is published to npm and bower as text-encoding.
Use through these is not really supported, since they aren't used by
the developer of the library. Using require() in interesting ways
probably breaks. Patches welcome, as long as they don't break the
basic use of the files via `
To support the legacy encodings (which may be stateful), the
TextEncoder `encode()` method accepts an optional dictionary and
`stream` option, e.g. `encoder.encode(string, {stream: true});` This
is not needed for standard encoding since the input is always in
complete code points.No open issues yet, or sync has not completed.