Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# This makes sure UTF8 characters don't break the encoding/decoding. For
# more info: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
#
App.Lib.Base64 =
encode: (str) ->
window.btoa unescape(encodeURIComponent(str))
decode: (str) ->
decodeURIComponent escape(window.atob(str))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment