diff --git a/notwebsocket.js b/notwebsocket.js index 6390cdab..7c88e305 100644 --- a/notwebsocket.js +++ b/notwebsocket.js @@ -151,7 +151,7 @@ function msgReceived(req, res) { sendJSON(res, clients[h].poll()); } else { - clients[h].recv(unescape(str)); + clients[h].recv(decodeURIComponent(str)); sendJSON(res, ""); } } diff --git a/www/assets/js/notwebsocket.js b/www/assets/js/notwebsocket.js index bb612bbe..ee0c1017 100644 --- a/www/assets/js/notwebsocket.js +++ b/www/assets/js/notwebsocket.js @@ -76,7 +76,7 @@ NotWebsocket.prototype.emit = function(msg, data) { return; } var pkt = [msg, data]; - var str = escape(JSON.stringify(pkt)).replace(/\//g, "%2F"); + var str = encodeURIComponent(JSON.stringify(pkt)).replace(/\//g, "%2F"); $.getJSON(WEB_URL+"/nws/"+this.hash+"/"+str+"?callback=?", function() { // Poll more quickly because sending a packet usually means // expecting some data to come back