Skip to content

Commit bf711f2

Browse files
committed
修复导出json和markdown时中文及其他utf8字符乱码问题
1 parent e1b065c commit bf711f2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/global.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ declare interface Window {
1919
};
2020
fs: {
2121
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
22+
writeTextFile(path: string, data: string): Promise<void>;
2223
};
2324
notification:{
2425
requestPermission(): Promise<Permission>;

app/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export async function downloadAs(text: string, filename: string) {
5252

5353
if (result !== null) {
5454
try {
55-
await window.__TAURI__.fs.writeBinaryFile(
55+
await window.__TAURI__.fs.writeTextFile(
5656
result,
57-
new Uint8Array([...text].map((c) => c.charCodeAt(0)))
57+
text
5858
);
5959
showToast(Locale.Download.Success);
6060
} catch (error) {

0 commit comments

Comments
 (0)