Set hard-coded delimiter (;) and escape char (") and better display

parsing errors
This commit is contained in:
2023-01-18 01:31:36 +01:00
parent 543a80413c
commit 977e7511ec
4 changed files with 18 additions and 87 deletions

View File

@ -24,10 +24,22 @@ class CsvxmlValidator {
this.fieldList = Object.freeze(fieldList);
const data = Papa.parse(csvRaw.trim(), {header: true});
const data = Papa.parse(csvRaw.trim(), {
delimiter: ";", // auto-detect
escapeChar: '"',
skipEmptyLines: true,
header: true,
});
if (data.errors.length !== 0) {
window.alert(data.errors);
console.log("Errors encountered: ");
console.error(data.errors);
let msg = '';
for (let err of data.errors) {
msg += err.type + ': ' + err.message + "\n";
}
window.alert(msg);
}
let toValidate = data.data;

File diff suppressed because one or more lines are too long