Telnet: Don't convert encoding when unnecessay

This commit is contained in:
NI
2019-09-15 12:14:53 +08:00
parent df116843f7
commit c90c4b1f9e

View File

@@ -453,7 +453,13 @@ class Control {
}
let currentLen = 0;
const enc = new iconv.encode(data, this.charset);
let enc = null;
if (this.charset !== "utf-8") {
enc = new iconv.encode(data, this.charset);
} else {
enc = new TextEncoder().encode(data);
}
while (currentLen < enc.length) {
const iacPos = this.searchNextIAC(currentLen, enc);