I want to try to read my csv file and convert it so that I have the german umlauts back in. How can I convert this?
my code:
export const convertCSV = (req: Request, res: Response) => {
const file = fs.readFileSync(path.resolve(__dirname, '..', 'files', 'csv.csv'), "utf-8");
let csvData: any = [];
papa.parse(file, {
dynamicTyping: true,
skipEmptyLines: true,
step: function (result) {
csvData.push(result.data)
},
complete: function (results, file) {
//console.log('Complete', results.data, 'records.');
}
})
res.status(200).send(csvData)
}
With this code I always get these characters � if I have an umlaut. How can I solve this problem?