Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: Dec 24, 2017 11:15 AM
Modified: Dec 24, 2017 11:18 AM
Views: 21
Tags: base64
  1. function b64DecodeUnicode(str) {
  2.     // Going backwards: from bytestream, to percent-encoding, to original string.
  3.     return decodeURIComponent(atob(str).split('').map(function(c) {
  4.         return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  5.     }).join(''));
  6. }
  7.  
  8. b64DecodeUnicode('4pyTIMOgIGxhIG1vZGU='); // "✓ à la mode"