diff --git a/public/index.html b/public/index.html index 103c744..f317cfb 100644 --- a/public/index.html +++ b/public/index.html @@ -1645,10 +1645,16 @@ } }, + decodeBase64ToUtf8String: function(base64) { + // support for decoding base64 as a utf8 string to support emojis and cyrillic characters etc + return decodeURIComponent(atob(base64).split('').map(function(c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }).join('')); + }, getPeerNameFromAppData: function(appData) { try { // app data should be peer name, and our server provides it base64 encoded - return atob(appData); + return this.decodeBase64ToUtf8String(appData); } catch(e){ return "Anonymous Peer"; } @@ -1656,7 +1662,7 @@ getNodeNameFromAppData: function(appData) { try { // app data should be node name, and our server provides it base64 encoded - return atob(appData); + return this.decodeBase64ToUtf8String(appData); } catch(e){ return "Anonymous Node"; }