From c90c4b1f9e5fd5a5fce81b7154772df8e773543d Mon Sep 17 00:00:00 2001 From: NI Date: Sun, 15 Sep 2019 12:14:53 +0800 Subject: [PATCH] Telnet: Don't convert encoding when unnecessay --- ui/control/telnet.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/control/telnet.js b/ui/control/telnet.js index 092e7d7..30df246 100644 --- a/ui/control/telnet.js +++ b/ui/control/telnet.js @@ -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);