Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 402a7e7

Browse files
author
Akos Kitta
committed
fix: encoding when reading a cloud sketch
Closes #449 Closes #634 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 01ee045 commit 402a7e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎arduino-ide-extension/src/browser/create/create-fs-provider.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ export class CreateFsProvider
154154

155155
async readFile(uri: URI): Promise<Uint8Array> {
156156
const content = await this.getCreateApi.readFile(uri.path.toString());
157-
return new TextEncoder().encode(content);
157+
// Text encoder can crash in electron browser: https://github.com/arduino/arduino-ide/issues/634#issuecomment-1440039171
158+
// Credit for the workaround: https://stackoverflow.com/a/45722000/5529090
159+
return Uint8Array.from(content, (char) => char.charCodeAt(0));
158160
}
159161

160162
async writeFile(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /