June 2015
Intermediate to advanced
192 pages
4h 8m
English
If you're going to use ArrayBuffer and DataView for your binary data and carry binary data as base64 strings, you can use the Mozilla-written functions at https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_.232_.E2.80.93_rewriting_atob%28%29_and_btoa%28%29_using_TypedArrays_and_UTF-8 to do so. They provide the functions strToUTF8Arr and UTF8ArrToStr to perform UTF-8 encoding and decoding, as well as base64EncArr and base64DecToArr to convert between base64 strings and array buffers.
Here's an interconversion example that encodes a text string as UTF-8, then converts the text into base64, then shows the base64 results, and finally converts ...
Read now
Unlock full access