Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.    
  3.     function decodeUTF8 (utftext) {
  4.         var text = "",
  5.         len = utftext.length,
  6.         i = 0,
  7.         c = c1 = c2 = 0,
  8.         fromCharCode = String.fromCharCode;
  9.  
  10.         while (i < len) {
  11.  
  12.             c = utftext.charCodeAt(i);
  13.  
  14.             if (c < 128) {
  15.                 text += fromCharCode(c);
  16.                 i++;
  17.             }
  18.             else if ((c > 191) && (c < 224)) {
  19.                 c2 = utftext.charCodeAt(i+1);
  20.                 text += fromCharCode(((c & 31) << 6) | (c2 & 63));
  21.                 i += 2;
  22.             }
  23.             else {
  24.                 c2 = utftext.charCodeAt(i+1);
  25.                 c3 = utftext.charCodeAt(i+2);
  26.                 text += fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
  27.                 i += 3;
  28.             }
  29.  
  30.         }
  31.  
  32.         return text;
  33.     }
  34.    
  35.     UI.clipReceive = (function(clipReceive) {
  36.         return function (rfb, text) {
  37.             return clipReceive(rfb, decodeUTF8(text))
  38.         };
  39.     })(UI.clipReceive);
  40.    
  41. })(UI);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement