Skip to content

Commit

Permalink
fix multichar decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Oct 11, 2024
1 parent 40e1f41 commit 66a5a21
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v86.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,13 @@ class V86Backend {
resolve(-1);
});
}

const streamDecoder = new TextDecoder(); // needs its own for stream: true option
this.sendWispFrame({
type: "CONNECT",
streamID: this.ptyNum,
command: command,
dataCallback: (data: Uint8Array) => {
const string = decoder.decode(data);
const string = streamDecoder.decode(data, { stream: true });
onData(string);
},
closeCallback: (data: number) => {
Expand Down Expand Up @@ -698,7 +698,7 @@ class V86Backend {
this.emulator.add_listener(
"virtio-console1-output-bytes",
async (data: Uint8Array) => {
evalBuffer += new TextDecoder().decode(data);
evalBuffer += decoder.decode(data);
if (evalBuffer.endsWith("\0")) {
const jsrun = evalBuffer.slice(0, -1);
evalBuffer = "";
Expand Down

0 comments on commit 66a5a21

Please sign in to comment.