Fix non-8bit string export problem
This commit is contained in:
parent
75540a3dd4
commit
48c474ed3a
3 changed files with 9 additions and 1 deletions
|
|
@ -1,9 +1,11 @@
|
|||
import utf8 from 'utf8'
|
||||
|
||||
export const newExporter = ({
|
||||
filename = 'data',
|
||||
getExportedObject
|
||||
}) => ({
|
||||
exportData () {
|
||||
const stringified = JSON.stringify(getExportedObject(), null, 2) // Pretty-print and indent with 2 spaces
|
||||
const stringified = utf8.encode(JSON.stringify(getExportedObject(), null, 2)) // Pretty-print and indent with 2 spaces
|
||||
|
||||
// Create an invisible link with a data url and simulate a click
|
||||
const e = document.createElement('a')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue