How does socket communication send Chinese gbk encoded strings?

interacts with a telent server, server communication code is gb2312

currently, the content requested from the server can be decoded with iconv, and the gb2312 sent by the server shows normal after decoding

    telnetInput.pipe(through2((chunk, enc, callback) => {
      chunk = iconv.decode(chunk, "gbk");
      chunk = chunk.replace(/((?:[\n\r]|^)<.*?>)\n\r?/g, "$1 ");
      if (chunk) {
        callback(null, chunk);
      } else {
        callback(null);
      }
    })).pipe(process.stdout);
    

but when sent to the server, the string type supported by nodejs does not have gbk class encoding

when typing, the encoding supported by readline,readline is consistent with that of nodejs, so if a friend replied before, use the ready-made module gbk to report an error that is not supported by coding.

this.telnetOutput.write(rawStr + "\n");

although the nodejs writable stream wirte supports the specified encoding, it also does not contain Chinese. The utf8 code is still received when sending Chinese to the server.

since the request for downlink data can be gbk encoding, how to send the original gbk encoding to the server?

Mar.18,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9cf24-1917.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9cf24-1917.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?