| 106 | } |
| 107 | |
| 108 | function Utf8Encode(string) { |
| 109 | string = string.replace(/\r\n/g, "\n"); |
| 110 | let utftext = ""; |
| 111 | |
| 112 | for (let n = 0; n < string.length; n++) { |
| 113 | |
| 114 | const c = string.charCodeAt(n); |
| 115 | |
| 116 | if (c < 128) { |
| 117 | utftext += String.fromCharCode(c); |
| 118 | } else if ((c > 127) && (c < 2048)) { |
| 119 | utftext += String.fromCharCode((c >> 6) | 192); |
| 120 | utftext += String.fromCharCode((c & 63) | 128); |
| 121 | } else { |
| 122 | utftext += String.fromCharCode((c >> 12) | 224); |
| 123 | utftext += String.fromCharCode(((c >> 6) & 63) | 128); |
| 124 | utftext += String.fromCharCode((c & 63) | 128); |
| 125 | } |
| 126 | |
| 127 | } |
| 128 | |
| 129 | return utftext; |
| 130 | } |
| 131 | |
| 132 | let k; |
| 133 | let AA; |