str = "The quick brown fox jumps over the lazy dog"; b64 = btoa(unescape(encodeURIComponent(str))); str = decodeURIComponent(escape(window.atob(b64)));