Skip to content

Instantly share code, notes, and snippets.

@ff6347
Last active November 13, 2019 07:37
Show Gist options
  • Select an option

  • Save ff6347/9685716f937cb16fbde14e855905fb4f to your computer and use it in GitHub Desktop.

Select an option

Save ff6347/9685716f937cb16fbde14e855905fb4f to your computer and use it in GitHub Desktop.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 3 in line 1.
BWID;BW_NAME;SHORT_BW_NAME;LONGITUDE_BW;LATITUDE_BW;COORDSYS_BW;BW_TYPE;BWATER_CAT;YEAR_BW;SAMPLE_DATE;CONC_EC;CONC_IE
DEBY_PR_FS_0187;MUEHL-SEE, NEUFAHRN B.FREISING, WASSERWACHTSHAUS;MUEHL-SEE;11.6558;48.3331;ETRS89;1;L;2009;2009-08-11;10;10
DEBY_PR_FS_0188;ANGELBERGER BADEWEIHER, ZOLLING;ANGELBERGER WEIHER;11.7903;48.4481;ETRS89;1;L;2009;2009-05-19;10;10
DEBY_PR_GAP_0192;LAUTERSEE, MITTENWALD;LAUTERSEE;11.2375;47.4403;ETRS89;1;L;2009;2009-08-17;10;10
DEBY_PR_GAP_0197;EICHSEE, GROSSWEIL;EICHSEE;11.3322;47.6797;ETRS89;1;L;2009;2009-05-25;10;10
DEBY_PR_GAP_0197;EICHSEE, GROSSWEIL;EICHSEE;11.3322;47.6797;ETRS89;1;L;2009;2009-08-17;10;10
DEBY_PR_GAP_0198;FERCHENSEE, MITTENWALD;FERCHENSEE;11.2153;47.4381;ETRS89;1;L;2009;2009-09-14;10;10
DEBY_PR_GAP_0199;FROSCHHAUSER SEE, MURNAU;FROSCHHAUSER SEE;11.2267;47.6875;ETRS89;1;L;2009;2009-04-27;10;10
DEBY_PR_GAP_0199;FROSCHHAUSER SEE, MURNAU;FROSCHHAUSER SEE;11.2267;47.6875;ETRS89;1;L;2009;2009-05-25;10;10
DEBY_PR_GAP_0199;FROSCHHAUSER SEE, MURNAU;FROSCHHAUSER SEE;11.2267;47.6875;ETRS89;1;L;2009;2009-08-17;32;10
const fs = require("fs");
const detectCharacterEncoding = require("detect-character-encoding");
// const path = process.cwd(); /*?. $ */
const fileBuffer = fs.readFileSync("./file.csv");
const charsetMatch = detectCharacterEncoding(fileBuffer);
console.log(charsetMatch);
{
"name": "get-encoding",
"version": "1.0.0",
"description": "",
"main": "get-encoding.js",
"scripts": {
"start": "node get-encoding.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"detect-character-encoding": "^0.8.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment