Skip to content

Conversation

@harshrajsinh-dev
Copy link

Fix: Remove UTF-8 BOM Before CSV Parsing

This PR fixes an issue where CSV files containing a UTF-8 BOM (EF BB BF) fail when used with the list from CSV table and list from CSV row blocks.

Certain editors automatically insert a BOM at the start of text files. When passed into fromCsvTable or fromCsvRow, the BOM becomes the first character of the first cell, causing the CSV parser to throw an error.

✅ What This PR Does

  • Detects a leading UTF-8 BOM (\uFEFF) in the input CSV string
  • Safely removes it before creating the CsvParser
  • Prevents “Cannot parse list as CSV table” errors
  • Has no effect on files that do not contain a BOM

🔧 Modified Methods

  • fromCsvTable
  • fromCsvRow

📌 Why This Matters

This improves App Inventor’s robustness, especially when users load CSV files created in Excel, Google Sheets, or text editors that include a BOM by default.

🔗 Related Issue

Fixes Issue #948: “Cannot parse list as CSV table error with BOM marker”

@AppInventorWorkerBee
Copy link
Collaborator

Can one of the admins verify this patch?

1 similar comment
@AppInventorWorkerBee
Copy link
Collaborator

Can one of the admins verify this patch?

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