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) {
12091209 // load content and append it to the list of files to open
12101210 let file = null
12111211 if ( selectedFile . source == 'board' ) {
1212+ // fileContent receives a raw buffer from loadFile()
12121213 const fileContent = await serialBridge . loadFile (
12131214 serialBridge . getFullPath (
12141215 state . boardNavigationRoot ,
12151216 state . boardNavigationPath ,
12161217 selectedFile . fileName
12171218 )
12181219 )
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 ) ;
12201224 file = createFile ( {
12211225 parentFolder : state . boardNavigationPath ,
12221226 fileName : selectedFile . fileName ,
You can’t perform that action at this time.
0 commit comments