aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-30 21:41:03 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-30 21:41:03 +0800
commit0312191ab81e6eb51ca26a0a89d5168b284fdc7b (patch)
tree824f0ea6052c602bb4e9bafade4ec857ab5612da /examples
parent8d9f6fcd7eb87c87e295918d3d178c8ab7a52be8 (diff)
Stripped some weird utf8 characters (\xc2\xa0) from extedit.js
Diffstat (limited to 'examples')
-rw-r--r--examples/data/uzbl/scripts/extedit.js115
1 files changed, 57 insertions, 58 deletions
diff --git a/examples/data/uzbl/scripts/extedit.js b/examples/data/uzbl/scripts/extedit.js
index bf77c87..8ed346d 100644
--- a/examples/data/uzbl/scripts/extedit.js
+++ b/examples/data/uzbl/scripts/extedit.js
@@ -1,4 +1,4 @@
-/*
+/*
* Edit forms in external editor
*
* (c) 2009, Robert Manea
@@ -17,69 +17,69 @@
* Usage:
* Select (click) an editable form, go to command mode and hit E
*
-*/
+*/
function utf8_decode ( str_data ) {
-    var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;
-   
-    str_data += '';
-   
-    while ( i < str_data.length ) {
-        c1 = str_data.charCodeAt(i);
-        if (c1 < 128) {
-            tmp_arr[ac++] = String.fromCharCode(c1);
-            i++;
-        } else if ((c1 > 191) && (c1 < 224)) {
-            c2 = str_data.charCodeAt(i+1);
-            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
-            i += 2;
-        } else {
-            c2 = str_data.charCodeAt(i+1);
-            c3 = str_data.charCodeAt(i+2);
-            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
-            i += 3;
-        }
-    }
-    return tmp_arr.join('');
+ var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;
+
+ str_data += '';
+
+ while ( i < str_data.length ) {
+ c1 = str_data.charCodeAt(i);
+ if (c1 < 128) {
+ tmp_arr[ac++] = String.fromCharCode(c1);
+ i++;
+ } else if ((c1 > 191) && (c1 < 224)) {
+ c2 = str_data.charCodeAt(i+1);
+ tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
+ i += 2;
+ } else {
+ c2 = str_data.charCodeAt(i+1);
+ c3 = str_data.charCodeAt(i+2);
+ tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+ i += 3;
+ }
+ }
+
+ return tmp_arr.join('');
}
function utf8_encode ( argString ) {
-    var string = (argString+''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
-    var utftext = "";
-    var start, end;
-    var stringl = 0;
-    start = end = 0;
-    stringl = string.length;
-    for (var n = 0; n < stringl; n++) {
-        var c1 = string.charCodeAt(n);
-        var enc = null;
-        if (c1 < 128) {
-            end++;
-        } else if (c1 > 127 && c1 < 2048) {
-            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
-        } else {
-            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
-        }
-        if (enc !== null) {
-            if (end > start) {
-                utftext += string.substring(start, end);
-            }
-            utftext += enc;
-            start = end = n+1;
-        }
-    }
-    if (end > start) {
-        utftext += string.substring(start, string.length);
-    }
-    return utftext;
+ var string = (argString+''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
+
+ var utftext = "";
+ var start, end;
+ var stringl = 0;
+
+ start = end = 0;
+ stringl = string.length;
+ for (var n = 0; n < stringl; n++) {
+ var c1 = string.charCodeAt(n);
+ var enc = null;
+
+ if (c1 < 128) {
+ end++;
+ } else if (c1 > 127 && c1 < 2048) {
+ enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
+ } else {
+ enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
+ }
+ if (enc !== null) {
+ if (end > start) {
+ utftext += string.substring(start, end);
+ }
+ utftext += enc;
+ start = end = n+1;
+ }
+ }
+
+ if (end > start) {
+ utftext += string.substring(start, string.length);
+ }
+
+ return utftext;
}
@@ -100,4 +100,3 @@ function utf8_encode ( argString ) {
}
})();
-