Skip to content

fix: handle non-UTF-8 encoded and semicolon-delimited CSV exports#1

Merged
nikolaischunk merged 1 commit into
mainfrom
claude/wizardly-bartik-4986e6
May 15, 2026
Merged

fix: handle non-UTF-8 encoded and semicolon-delimited CSV exports#1
nikolaischunk merged 1 commit into
mainfrom
claude/wizardly-bartik-4986e6

Conversation

@nikolaischunk
Copy link
Copy Markdown
Contributor

Summary

  • Smart encoding detection for CSV uploads — tries UTF-8, Mac OS Roman, cp1252, latin-1 and picks the first where expected headers match

  • Unicode-normalized header matching so Gesamtsumme Erlös is found regardless of encoding quirks

  • Auto-detect ; vs , delimiter from the header row

  • Relaxed KDE customer header detection to handle exports where summary numbers appear on the customer row

  • Added Next.js Route Handler (src/app/api/process/route.ts) so the Python processing works with next dev locally without needing vercel dev

Context

Sales exports from the ICON system can arrive in Mac OS Roman encoding with semicolon delimiters. The processor rejected these files because the ö in "Gesamtsumme Erlös" was destroyed by the UTF-8 fallback decoder, failing header validation.

Sales exports from the ICON system can arrive in Mac OS Roman encoding
(instead of UTF-8) and use semicolons as delimiters (instead of commas).
The processor rejected these files because the ö in "Gesamtsumme Erlös"
was destroyed by the UTF-8 fallback decoder, failing header validation.

Fixes:
- Smart encoding detection: tries UTF-8, mac_roman, cp1252, latin-1 and
  picks the first encoding where expected headers are actually found
- Unicode-normalized header matching (NFC + whitespace collapse)
- Auto-detect delimiter (;  vs ,) from the header row
- Relaxed KDE customer header detection to ignore summary numeric columns

Also adds a Next.js Route Handler (src/app/api/process/route.ts) that
proxies to the Python script locally, so `next dev` can serve the API
without needing `vercel dev` or a linked Vercel project.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
icon-apps Building Building Preview, Comment May 15, 2026 3:18pm

@nikolaischunk nikolaischunk merged commit 6966dbe into main May 15, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant