diff --git a/src/danfojs-base/io/browser/io.csv.ts b/src/danfojs-base/io/browser/io.csv.ts index 7faa8be8..daac8ba9 100644 --- a/src/danfojs-base/io/browser/io.csv.ts +++ b/src/danfojs-base/io/browser/io.csv.ts @@ -163,7 +163,7 @@ const $toCSV = (df: NDframe | DataFrame | Series, options?: CsvOutputOptionsBrow */ const $downloadFileInBrowser = (content: any, fileName: string) => { var hiddenElement = document.createElement('a'); - hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(content); + hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURIComponent(content); hiddenElement.target = '_blank'; hiddenElement.download = fileName; hiddenElement.click(); diff --git a/src/danfojs-base/io/browser/io.json.ts b/src/danfojs-base/io/browser/io.json.ts index 131140c0..5a11f324 100644 --- a/src/danfojs-base/io/browser/io.json.ts +++ b/src/danfojs-base/io/browser/io.json.ts @@ -174,7 +174,7 @@ const $toJSON = (df: NDframe | DataFrame | Series, options?: JsonOutputOptionsBr */ const $downloadFileInBrowser = (content: any, fileName: string) => { var hiddenElement = document.createElement('a'); - hiddenElement.href = 'data:text/json;charset=utf-8,' + encodeURI(JSON.stringify(content)); + hiddenElement.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(content)); hiddenElement.target = '_blank'; hiddenElement.download = fileName; hiddenElement.click();