The JavaScript Encoding API allows developers to encode and decode strings using a wide range of
character encodings.
The example on this page illustrates decoding data from a file into JavaScript strings.
The code obtains raw binary ArrayBuffer by making an XMLHttpRequest
for a local file. The code then calls TextDecoder.decode() to translate the data
into a string, given the appropriate character encoding.
In a real world scenario, source data might be read from files that predate Unicode
or from a legacy database system that only supported a specific character encoding.