Skip to content

Commit

Permalink
Merge pull request #4 from ifTNT/fix-unicode
Browse files Browse the repository at this point in the history
[fix] Add unicode support
  • Loading branch information
vivek-nexus authored Feb 21, 2024
2 parents cfc0b93 + c56716a commit 32d4d18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ function downloadTranscript() {
// Create a download
// Use Chrome Download API
chrome.downloads.download({
url: 'data:text/plain;base64,' + btoa(textContent),
url: 'data:text/plain;base64,' + encodeUnicodeString(textContent),
filename: fileName,
conflictAction: 'uniquify' // Automatically rename the file if it already exists
}).then(() => {
console.log("Transcript downloaded to TranscripTonic directory")
}).catch((error) => {
console.log(error)
chrome.downloads.download({
url: 'data:text/plain;base64,' + btoa(textContent),
url: 'data:text/plain;base64,' + encodeUnicodeString(textContent),
filename: "TranscripTonic/Transcript.txt",
conflictAction: 'uniquify' // Automatically rename the file if it already exists
})
Expand All @@ -65,4 +65,11 @@ function downloadTranscript() {
else
console.log("No transcript found")
})
}
}

// Thanks to @ifTNT(https://github.com/vivek-nexus/transcriptonic/pull/4)
function encodeUnicodeString(text) {
const utf8Bytes = new TextEncoder().encode(text)
const binaryString = String.fromCodePoint(...utf8Bytes);
return btoa(binaryString);
}
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TranscripTonic",
"version": "2.0.0",
"version": "2.0.1",
"manifest_version": 3,
"description": "Simple Google Meet transcripts. Private and open source.",
"action": {
Expand Down

0 comments on commit 32d4d18

Please sign in to comment.