fix: allow explicit MobaXterm import encoding

This commit is contained in:
bincxz committed 2026-07-13 00:00:52 +08:00
1 parent e3510f8a50
commit d1b8d97c0c
10 files changed
+139 -6

No files matched your search

+9
View File
@@ -48,3 +48,12 @@ test("readTextFile keeps valid UTF-8 when a fallback encoding is configured", as
"[Bookmarks]\n中文服务器",
);
});
test("readTextFile honors an explicit encoding for ambiguous bytes", async () => {
const file = new File([new Uint8Array([0xc2, 0xa1])], "MobaXterm.ini", {
type: "text/plain",
});
assert.equal(await readTextFile(file, { encoding: "utf-8" }), "¡");
assert.equal(await readTextFile(file, { encoding: "gb18030" }), "隆");
});