Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#3972 from greenjerry/fix-export-gar…
Browse files Browse the repository at this point in the history
…bled

fix: 修复导出时字符乱码问题
  • Loading branch information
fred-bf authored Mar 7, 2024
2 parents 5529ece + 2bf6111 commit ff9f0e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ declare interface Window {
};
fs: {
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
writeTextFile(path: string, data: string): Promise<void>;
};
notification:{
requestPermission(): Promise<Permission>;
Expand Down
4 changes: 2 additions & 2 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export async function downloadAs(text: string, filename: string) {

if (result !== null) {
try {
await window.__TAURI__.fs.writeBinaryFile(
await window.__TAURI__.fs.writeTextFile(
result,
new Uint8Array([...text].map((c) => c.charCodeAt(0))),
text
);
showToast(Locale.Download.Success);
} catch (error) {
Expand Down

0 comments on commit ff9f0e6

Please sign in to comment.