feat(kantine-datev): Kantinenabrechnung als Modul in neuer Gruppe Finanzbuchhaltung
- neue Seitenleisten-Kategorie accounting (Finanzbuchhaltung / Financial accounting) - CSV (UTF-8, UTF-8 mit BOM, Windows-1252) pruefen, Vorschau mit Zeilenfehlern, DATEV-Lohn-ASCII-Export - Beraternummer, Mandantennummer, Lohnart je Mandant als Admin-Einstellung (KantineDatevConfig mit Zeilenschutz), anfangs leer - hochgeladene Daten werden nicht gespeichert; Download per Blob (auch im Desktop-Client) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Dekodiert hochgeladene CSV-Bytes zu Text (quick-261002-fm5).
|
||||
*
|
||||
* Excel und Warenwirtschaftssysteme liefern CSV entweder als UTF-8 (mit oder
|
||||
* ohne Byte-Order-Mark) oder als Windows-1252. Zuerst wird streng als UTF-8
|
||||
* gelesen: sind die Bytes kein gueltiges UTF-8 (typisch bei Umlauten in
|
||||
* Windows-1252), faellt die Funktion auf Windows-1252 zurueck. `TextDecoder`
|
||||
* verwirft ein fuehrendes BOM standardmaessig.
|
||||
*
|
||||
* Gemeinsam genutzt von Kantinenabrechnung und Handelsware.
|
||||
*/
|
||||
export function decodeCsvText(buffer: Buffer): string {
|
||||
try {
|
||||
return new TextDecoder('utf-8', { fatal: true }).decode(buffer);
|
||||
} catch {
|
||||
return new TextDecoder('windows-1252').decode(buffer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user