Skip to content

Commit 7c86f1f

Browse files
palazzolz3bra5hax
andauthored
Fix corruption of incoming UTF-8-encoded serial data (#1758)
* Fix corruption of incoming UTF-8-encoded serial data * Make TextDecoder() readonly because it can be Co-authored-by: z3bra <[email protected]>
1 parent f8c01e3 commit 7c86f1f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: arduino-ide-extension/src/node/monitor-service.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
8080
private readonly board: Board;
8181
private readonly port: Port;
8282
private readonly monitorID: string;
83+
private readonly streamingTextDecoder = new TextDecoder('utf8');
8384

8485
/**
8586
* The lightweight representation of the port configuration currently in use for the running monitor.
@@ -319,7 +320,7 @@ export class MonitorService extends CoreClientAware implements Disposable {
319320
const message =
320321
typeof data === 'string'
321322
? data
322-
: new TextDecoder('utf8').decode(data);
323+
: this.streamingTextDecoder.decode(data, {stream:true});
323324
this.messages.push(...splitLines(message));
324325
},
325326
},

0 commit comments

Comments
 (0)