The comment is incorrect :-( - Just proving the confusion. + // btoa takes a binary string to encode. unescape(encodeURIComponent(source)) + // does UTF-8 to binary conversion. See bug 1551746 for other ways. Correct is this: unescape(encodeURIComponent(source)) encodes the JavaScript UTF-16 representation of the string into UTF-8. And please lose the comment about btoa. It just takes some bytes, and bytes are always binary, in fact, everything is binary ;-)
Bug 1617370 Comment 14 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The comment is incorrect :-( - Just proving the confusion. ``` + // btoa takes a binary string to encode. unescape(encodeURIComponent(source)) + // does UTF-8 to binary conversion. See bug 1551746 for other ways. ``` Correct is this: unescape(encodeURIComponent(source)) encodes the JavaScript UTF-16 representation of the string into UTF-8. And please lose the comment about btoa. It just takes some bytes, and bytes are always binary, in fact, everything is binary ;-)