From b7996b048bd9d47504899d88973d7fff1dc8af60 Mon Sep 17 00:00:00 2001 From: samhed Date: Fri, 14 Mar 2014 15:18:05 +0100 Subject: [PATCH] Added a wrapper for the UTF-8 decoding. --- include/rfb.js | 2 +- include/util.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/rfb.js b/include/rfb.js index 9dad36aa..173f6997 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -923,7 +923,7 @@ init_msg = function() { /* Connection name/title */ name_length = ws.rQshift32(); - fb_name = decodeURIComponent(escape(ws.rQshiftStr(name_length))); + fb_name = Util.decodeUTF8(ws.rQshiftStr(name_length)); conf.onDesktopName(that, fb_name); if (conf.true_color && fb_name === "Intel(r) AMT KVM") diff --git a/include/util.js b/include/util.js index 8893591c..1c02676c 100644 --- a/include/util.js +++ b/include/util.js @@ -202,6 +202,14 @@ Util.conf_defaults = function(cfg, api, defaults, arr) { } }; +/* + * Decode from UTF-8 + */ +Util.decodeUTF8 = function(utf8string) { + return decodeURIComponent(escape(utf8string)); +} + + /* * Cross-browser routines