Skip to content

Commit

Permalink
Use utf8 enconding when saving panel contents to support non-ascii ch…
Browse files Browse the repository at this point in the history
…aracters.
  • Loading branch information
barnettwilliam committed Jan 31, 2024
1 parent d96d2d2 commit 90e23ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion platform/src/FileHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class FileHandler {
return Uint8Array.from(binString, (m) => m.codePointAt(0));
}

bytesToBase64(bytes) {
const binString = String.fromCodePoint(...bytes);
return window.btoa(binString);
}

fetchFile(url, isPrivate){

if (isPrivate){
Expand Down Expand Up @@ -70,7 +75,7 @@ class FileHandler {
request.params.message = message;

request.params.sha= sha;
request.params.content= window.btoa(newFileContent);
request.params.content= this.bytesToBase64( new TextEncoder().encode(newFileContent) );

if(branch != null){
request.params.branch = branch;
Expand Down

0 comments on commit 90e23ba

Please sign in to comment.