From 74144da45fc0a7a2c2e88d17a23b584ba77e9262 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Mon, 15 Jun 2026 22:39:32 +0200 Subject: [PATCH] fix(accounting): UTF-8 BOM on the ledger export so Banana reads it correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- backend/src/routes/adminLedger.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/adminLedger.js b/backend/src/routes/adminLedger.js index 8b05d28e..fdd8cc83 100644 --- a/backend/src/routes/adminLedger.js +++ b/backend/src/routes/adminLedger.js @@ -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;