1var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 2var base64DecodeChars = new Array( 3ãã-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4ãã-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5ãã-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 6ãã52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, 7ãã-1,ã0,ã1,ã2,ã3, 4,ã5,ã6,ã7,ã8,ã9, 10, 11, 12, 13, 14, 8ãã15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, 9ãã-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 10ãã41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); 11function base64encode(str) { 12ããvar out, i, len; 13ããvar c1, c2, c3; 14ããlen = str.length; 15ããi = 0; 16ããout = ""; 17ããwhile(i < len) { 18 c1 = str.charCodeAt(i++) & 0xff; 19 if(i == len) 20 { 21ãã out += base64EncodeChars.charAt(c1 >> 2); 22ãã out += base64EncodeChars.charAt((c1 & 0x3) << 4); 23ãã out += "=="; 24ãã break; 25 } 26 c2 = str.charCodeAt(i++); 27 if(i == len) 28 { 29ãã out += base64EncodeChars.charAt(c1 >> 2); 30ãã out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); 31ãã out += base64EncodeChars.charAt((c2 & 0xF) << 2); 32ãã out += "="; 33ãã break; 34 } 35 c3 = str.charCodeAt(i++); 36 out += base64EncodeChars.charAt(c1 >> 2); 37 out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)); 38 out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)); 39 out += base64EncodeChars.charAt(c3 & 0x3F); 40ãã} 41ããreturn out; 42} 43function base64decode(str) { 44ããvar c1, c2, c3, c4; 45ããvar i, len, out; 46ããlen = str.length; 47ããi = 0; 48ããout = ""; 49ããwhile(i < len) { 50 51 do { 52ãã c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; 53 } while(i < len && c1 == -1); 54 if(c1 == -1) 55ãã break; 56 57 do { 58ãã c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff]; 59 } while(i < len && c2 == -1); 60 if(c2 == -1) 61ãã break; 62 out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); 63 64 do { 65ãã c3 = str.charCodeAt(i++) & 0xff; 66ãã if(c3 == 61) 67ãreturn out; 68ãã c3 = base64DecodeChars[c3]; 69 } while(i < len && c3 == -1); 70 if(c3 == -1) 71ãã break; 72 out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); 73 74 do { 75ãã c4 = str.charCodeAt(i++) & 0xff; 76ãã if(c4 == 61) 77ãreturn out; 78ãã c4 = base64DecodeChars[c4]; 79 } while(i < len && c4 == -1); 80 if(c4 == -1) 81ãã break; 82 out += String.fromCharCode(((c3 & 0x03) << 6) | c4); 83ãã} 84ããreturn out; 85} 86function utf16to8(str) { 87ããvar out, i, len, c; 88ããout = ""; 89ããlen = str.length; 90ããfor(i = 0; i < len; i++) { 91 c = str.charCodeAt(i); 92 if ((c >= 0x0001) && (c <= 0x007F)) { 93ãã out += str.charAt(i); 94 } else if (c > 0x07FF) { 95ãã out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); 96ãã out += String.fromCharCode(0x80 | ((c >>ã6) & 0x3F)); 97ãã out += String.fromCharCode(0x80 | ((c >>ã0) & 0x3F)); 98 } else { 99ãã out += String.fromCharCode(0xC0 | ((c >>ã6) & 0x1F)); 100ãã out += String.fromCharCode(0x80 | ((c >>ã0) & 0x3F)); 101 } 102ãã} 103ããreturn out; 104} 105function utf8to16(str) { 106ããvar out, i, len, c; 107ããvar char2, char3; 108ããout = ""; 109ããlen = str.length; 110ããi = 0; 111ããwhile(i < len) { 112 c = str.charCodeAt(i++); 113 switch(c >> 4) 114 { 115ã case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: 116ãã // 0xxxxxxx 117ãã out += str.charAt(i-1); 118ãã break; 119ã case 12: case 13: 120ãã // 110x xxxxã 10xx xxxx 121ãã char2 = str.charCodeAt(i++); 122ãã out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); 123ãã break; 124ã case 14: 125ãã // 1110 xxxxã10xx xxxxã10xx xxxx 126ãã char2 = str.charCodeAt(i++); 127ãã char3 = str.charCodeAt(i++); 128ãã out += String.fromCharCode(((c & 0x0F) << 12) | 129ãããã((char2 & 0x3F) << 6) | 130ãããã((char3 & 0x3F) << 0)); 131ãã break; 132 } 133ãã} 134ããreturn out; 135} 136function doit() { 137ããvar f = document.f 138ããf.output.value = base64encode(utf16to8(f.source.value)) 139ãã//f.decode.value = utf8to16(base64decode(f.output.value)) 140} 141function toDoit() { 142ããvar f = document.f 143ãã//f.output.value = base64encode(utf16to8(f.source.value)) 144ããf.decode.value = utf8to16(base64decode(f.output.value)) 145}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.