Since btoa interprets the code points of its input string as byte values, calling btoa on a string will cause a "Character Out Of Range" exception if a character's code point exceeds 0xff.
This patch replaces the btoa with the recommended solution from MDN, which encodes the Unicode string to the single-byte representation before passing it to btoa.
Since
btoa
interprets the code points of its input string as byte values, callingbtoa
on a string will cause a "Character Out Of Range" exception if a character's code point exceeds 0xff.This patch replaces the
btoa
with the recommended solution from MDN, which encodes the Unicode string to the single-byte representation before passing it tobtoa
.Reference: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem