Skip to content

fix(import): accept CSV files saved with a UTF-8 BOM - #877

Merged
evilguy4000 merged 1 commit into
DRYTRIX:developfrom
jayhemnani9910:fix/csv-import-utf8-bom
Nov 15, 2026
Merged

evilguy4000 merged 1 commit into
DRYTRIX:developfrom
jayhemnani9910:fix/csv-import-utf8-bom

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Saving the CSV import template from Excel as "CSV UTF-8" (the option needed for non-ASCII client or project names) adds a UTF-8 byte order mark. The import routes decode the upload with utf-8, which keeps the BOM, so csv.DictReader reads the first header as project_name and every row fails:

POST /api/import/csv  ->  {"successful": 0, "failed": 1, "errors": ["Row 1: import failed"]}

The client import (/api/import/csv/clients) has the same problem with its name column. Both now decode with utf-8-sig, as the bank statement import already does (bank_reconciliation.py). Files without a BOM decode the same as before.

Added tests/test_import_csv_bom.py with one BOM upload per route; both fail without the change. (tests/test_import_export.py is skipped as a whole, so the tests are in a new file.) The import, export and client test files pass, with no failures besides those two before the change.

@evilguy4000
evilguy4000 merged commit fd90955 into DRYTRIX:develop Nov 15, 2026
24 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.

2 participants