Merge pull request #3972 from greenjerry/fix-export-garbled
fix: 修复导出时字符乱码问题
This commit is contained in:
commit
ff9f0e60ac
|
@ -19,6 +19,7 @@ declare interface Window {
|
||||||
};
|
};
|
||||||
fs: {
|
fs: {
|
||||||
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
|
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
|
||||||
|
writeTextFile(path: string, data: string): Promise<void>;
|
||||||
};
|
};
|
||||||
notification:{
|
notification:{
|
||||||
requestPermission(): Promise<Permission>;
|
requestPermission(): Promise<Permission>;
|
||||||
|
|
|
@ -57,9 +57,9 @@ export async function downloadAs(text: string, filename: string) {
|
||||||
|
|
||||||
if (result !== null) {
|
if (result !== null) {
|
||||||
try {
|
try {
|
||||||
await window.__TAURI__.fs.writeBinaryFile(
|
await window.__TAURI__.fs.writeTextFile(
|
||||||
result,
|
result,
|
||||||
new Uint8Array([...text].map((c) => c.charCodeAt(0))),
|
text
|
||||||
);
|
);
|
||||||
showToast(Locale.Download.Success);
|
showToast(Locale.Download.Success);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue