Skip to content

Conversation

HerringtonDarkholme
Copy link
Member

atob / btoa only supports ASCII string which makes playground fails
to save unicode source. This patch add unicode support by combining
escape/encodeURIComponent. escape is chosen for backward
compatibility.

MDN suggests to use Uint16Array to encode unicode before btoa, which is a modern solution. However, it is not backward-compatible.

Reference: https://base64.guru/developers/javascript/examples/unicode-strings

atob/btoa only supports ASCII string which makes playground fails
to save unicode source. This patch add unicode support by combining
escape/encodeURIComponent. `escape` is chosen for backward
compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants