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