Convert Telnet output to the correct charset as well
This commit is contained in:
@@ -15,6 +15,7 @@ Major dependencies includes:
|
||||
- [normalize.css](https://github.com/necolas/normalize.css), Licensed under MIT license
|
||||
- [Roboto font](https://en.wikipedia.org/wiki/Roboto), Licensed under Apache license.
|
||||
Packaged by [Christian Hoffmeister](https://github.com/choffmeister/roboto-fontface-bower), Licensed under Apache 2.0
|
||||
- [iconv-lite](https://github.com/ashtuchkin/iconv-lite), Licensed under MIT license
|
||||
|
||||
## For back-end application
|
||||
|
||||
|
||||
17
package-lock.json
generated
17
package-lock.json
generated
@@ -5023,6 +5023,17 @@
|
||||
"chardet": "^0.7.0",
|
||||
"iconv-lite": "^0.4.24",
|
||||
"tmp": "^0.0.33"
|
||||
},
|
||||
"dependencies": {
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"extglob": {
|
||||
@@ -6630,9 +6641,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz",
|
||||
"integrity": "sha512-NnEhI9hIEKHOzJ4f697DMz9IQEXr/MMJ5w64vN2/4Ai+wRnvV7SBrL0KLoRlwaKVghOc7LQ5YkPLuX146b6Ydw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"file-loader": "^4.2.0",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"iconv-lite": "^0.5.0",
|
||||
"imagemin-webpack-plugin": "^2.4.2",
|
||||
"mini-css-extract-plugin": "^0.5.0",
|
||||
"mocha": "^6.2.0",
|
||||
|
||||
@@ -46,13 +46,10 @@ export const charsetPresets = [
|
||||
"windows-1256",
|
||||
"windows-1257",
|
||||
"windows-1258",
|
||||
"x-mac-cyrillic",
|
||||
"gbk",
|
||||
"gb18030",
|
||||
"hz-gb-2312",
|
||||
"big5",
|
||||
"euc-jp",
|
||||
"iso-2022-jp",
|
||||
"shift-jis",
|
||||
"euc-kr",
|
||||
"iso-2022-kr",
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import * as iconv from "iconv-lite";
|
||||
|
||||
import * as subscribe from "../stream/subscribe.js";
|
||||
import * as reader from "../stream/reader.js";
|
||||
import * as color from "../commands/color.js";
|
||||
@@ -331,12 +333,14 @@ class Control {
|
||||
this.colorM = color;
|
||||
this.colors = this.colorM.get();
|
||||
|
||||
if (!data.charset || data.charset === "utf-8") {
|
||||
this.charset = data.charset;
|
||||
|
||||
if (this.charset === "utf-8") {
|
||||
this.charsetDecoder = d => {
|
||||
return d;
|
||||
};
|
||||
} else {
|
||||
let dec = new TextDecoder(data.charset),
|
||||
let dec = new TextDecoder(this.charset),
|
||||
enc = new TextEncoder();
|
||||
|
||||
this.charsetDecoder = d => {
|
||||
@@ -449,7 +453,7 @@ class Control {
|
||||
}
|
||||
|
||||
let currentLen = 0;
|
||||
const enc = new TextEncoder("utf-8").encode(data);
|
||||
const enc = new iconv.encode(data, this.charset);
|
||||
|
||||
while (currentLen < enc.length) {
|
||||
const iacPos = this.searchNextIAC(currentLen, enc);
|
||||
|
||||
Reference in New Issue
Block a user