Did you know that the global
atobmethods in browsers only support extended ASCII characters? For example,
btoa('foo ♥ bar')throws an error. A proper Base64 encoder encodes strings as UTF-8 first, and then encodes the resulting byte sequence as Base64. When decoding, Base64 decoding is performed first, followed by UTF-8 decoding.