fix: handle non-UTF-8 encoded and semicolon-delimited CSV exports#1
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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ösis found regardless of encoding quirksAuto-detect
;vs,delimiter from the header rowRelaxed 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 withnext devlocally without needingvercel devContext
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.