refactor(web-react): add encoder to support non-ASCII characters csv download (#10496)

This commit is contained in:
PeamThom 2024-06-29 04:31:22 +07:00 committed by GitHub
parent cf3ccf0ba9
commit 71e79ba40d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
export function downloadFile(data: string, title: string) {
const blobx = new Blob([data], { type: 'text/plain' }); // ! Blob
const blobx = new Blob([data], { type: 'text/plain;chartset=utf-8' }); // ! Blob
const elemx = window.document.createElement('a');
elemx.href = window.URL.createObjectURL(blobx); // ! createObjectURL
elemx.download = title;