File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1209,14 +1209,18 @@ async function store(state, emitter) {
1209
1209
// load content and append it to the list of files to open
1210
1210
let file = null
1211
1211
if ( selectedFile . source == 'board' ) {
1212
+ // fileContent receives a raw buffer from loadFile()
1212
1213
const fileContent = await serialBridge . loadFile (
1213
1214
serialBridge . getFullPath (
1214
1215
state . boardNavigationRoot ,
1215
1216
state . boardNavigationPath ,
1216
1217
selectedFile . fileName
1217
1218
)
1218
1219
)
1219
- const bytesToSource = String . fromCharCode ( ...fileContent ) ;
1220
+ // we convert the buffer to a Uint8Array
1221
+ const contentArray = new Uint8Array ( fileContent ) ;
1222
+ // we feed the Uint8Array to the TextDecoder
1223
+ const bytesToSource = new TextDecoder ( 'utf-8' ) . decode ( contentArray ) ;
1220
1224
file = createFile ( {
1221
1225
parentFolder : state . boardNavigationPath ,
1222
1226
fileName : selectedFile . fileName ,
You can’t perform that action at this time.
0 commit comments