fixes encoding issue of file to work with non-english chars

This commit is contained in:
kevmodrome 2020-12-18 11:10:36 +01:00
parent 512618f1ed
commit d62f0752da
No known key found for this signature in database
GPG Key ID: 828D8FE4D235B551
2 changed files with 4 additions and 2 deletions

View File

@ -18,6 +18,7 @@
let schema = {}
let fields = []
$: console.log(files[0])
$: valid = !schema || fields.every(column => schema[column].success)
$: dataImport = {
valid,
@ -43,6 +44,7 @@
}
async function validateCSV() {
console.log(csvString)
const response = await api.post("/api/tables/csv/validate", {
csvString,
schema: schema || {},
@ -82,7 +84,7 @@
files = fileArray
validateCSV()
})
reader.readAsBinaryString(fileArray[0])
reader.readAsText(fileArray[0])
}
async function omitColumn(columnName) {

View File

@ -1,4 +1,4 @@
"Name","Age","Address"
"Bert","4324","5 Sesame Street"
"Bertå","4324","5 Sesame Street"
"Ernie","34","1 World Trade Center"
"Big Bird","23423","44 Second Avenue"
1 Name Age Address
2 Bert Bertå 4324 5 Sesame Street
3 Ernie 34 1 World Trade Center
4 Big Bird 23423 44 Second Avenue