From 2a29d797e87651c85ae8f9ad1da810bc9ceddfa5 Mon Sep 17 00:00:00 2001 From: cong_wang Date: Fri, 9 Aug 2024 09:34:51 +0800 Subject: [PATCH] fix: Fix the issue of exporting CSV files causing character encoding problems --- CHANGELOG.md | 4 ++++ package.json | 4 ++-- src/common/utils/download.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2238e03..2530d9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### v5.2.2 + +-[fix] Fix the issue of exporting CSV files causing character encoding problems + ### v5.2.1 - [fix] Fix the issue with Phalcon Explorer button on Solscan Transaction Details page diff --git a/package.json b/package.json index 3506f80..2d1fe3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metasuites", - "version": "5.2.1", + "version": "5.2.2", "repository": { "type": "git", "url": "https://github.com/blocksecteam/metasuites.git" @@ -41,7 +41,7 @@ "ethers": "^6.0.8", "is-mobile": "^4.0.0", "jquery": "^3.6.3", - "json-2-csv": "^4.0.0", + "json-2-csv": "^5.5.5", "json-bigint": "^1.0.0", "ky": "^0.33.3", "lodash-es": "^4.17.21", diff --git a/src/common/utils/download.ts b/src/common/utils/download.ts index 34a5fd4..328119d 100644 --- a/src/common/utils/download.ts +++ b/src/common/utils/download.ts @@ -35,7 +35,7 @@ export const downloadCsv = async ( const isTwoDimensionalArray = json.length > 0 && Array.isArray(json[0]) const jsonStr = isTwoDimensionalArray ? convertToCSV(json as string[][]) - : await json2csv(json) + : json2csv(json, { excelBOM: true }) const url = window.URL || window.webkitURL || window const blob = new Blob([jsonStr]) const saveLink = document.createElementNS(