Skip to content

Instantly share code, notes, and snippets.

@gosukiwi
Created April 23, 2019 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gosukiwi/4739571476652e4c03f8fca88a39d465 to your computer and use it in GitHub Desktop.
Save gosukiwi/4739571476652e4c03f8fca88a39d465 to your computer and use it in GitHub Desktop.
# 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