This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ucs-2 string to base64 encoded ascii | |
function utoa(str) { | |
return window.btoa(unescape(encodeURIComponent(str))); | |
} | |
// base64 encoded ascii to ucs-2 string | |
function atou(str) { | |
return decodeURIComponent(escape(window.atob(str))); | |
} | |
// Usage: | |
utoa('✓ à la mode'); // 4pyTIMOgIGxhIG1vZGU= |
OlderNewer