fix(accounting): UTF-8 BOM on the ledger export so Banana reads it correctly

The /ledger/export route sent the file without a BOM, so Banana (and Excel)
decoded it as the local charset — the '·' description separator and any umlauts
imported as mojibake ('·'). Prepend the EF BB BF BOM like the tax-report CSV
route already does.
This commit is contained in:
Luca
2026-06-15 22:39:32 +02:00
parent a19506749a
commit 74144da45f
+7 -1
View File
@@ -121,7 +121,13 @@ router.get('/export', requirePermission('bills.view'),
});
res.setHeader('Content-Type', contentType);
res.setHeader('Content-Disposition', `attachment; filename="${filename}"`);
return res.send(content);
// UTF-8 BOM (EF BB BF) so Banana / Excel detect the encoding — without it
// the file is read as the local charset and "·" / umlauts become mojibake
// ("·"). Mirrors the tax-report CSV route.
const bom = Buffer.from([0xEF, 0xBB, 0xBF]);
const body = Buffer.concat([bom, Buffer.from(content, 'utf8')]);
res.setHeader('Content-Length', String(body.length));
return res.end(body);
}));
module.exports = router;