Set hard-coded delimiter (;) and escape char (") and better display
parsing errors
This commit is contained in:
parent
543a80413c
commit
977e7511ec
|
@ -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;
|
||||
|
|
83
public/assets/js/csvxmlV2.min.js
vendored
83
public/assets/js/csvxmlV2.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000008" />
|
||||
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000009" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<meta name="theme-color" content="#aa4400" />
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
</head>
|
||||
<body class="loading">
|
||||
|
||||
<script src="assets/js/csvxmlV2.min.js?v000008" type="text/javascript" async></script>
|
||||
<script src="assets/js/csvxmlV2.min.js?v000009" type="text/javascript" async></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -7,7 +7,7 @@
|
|||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
const GET_PARAM_JS_CSS = "v000008";
|
||||
const GET_PARAM_JS_CSS = "v000009";
|
||||
|
||||
/**
|
||||
* Generates the json for a translation file.
|
||||
|
|
Loading…
Reference in New Issue
Block a user