fix: update CSV import to correctly decode Windows-1252 encoding for venue names
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 51s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 51s
This commit is contained in:
@@ -72,9 +72,12 @@ class MatchService {
|
||||
async importCSV(userToken, clubId, filePath) {
|
||||
await checkAccess(userToken, clubId);
|
||||
let seasonString = '';
|
||||
const matches = [];
|
||||
try {
|
||||
const fileStream = fs.createReadStream(filePath)
|
||||
.pipe(iconv.decodeStream('utf8'))
|
||||
// click-TT exports this file as Windows-1252 / ISO-8859-1.
|
||||
// Decoding it as UTF-8 corrupts umlauts in venue names and addresses.
|
||||
.pipe(iconv.decodeStream('win1252'))
|
||||
.pipe(csv({ separator: ';' }));
|
||||
for await (const row of fileStream) {
|
||||
const parsedDate = parse(row['Termin'], 'dd.MM.yyyy HH:mm', new Date());
|
||||
|
||||
Reference in New Issue
Block a user