Urgent.News

What's breaking now, across thousands of outlets.

Tech

CSV to JSON: the three cases that break every naive parser

A CSV file is not comma-separated. It is comma-separated, with a quoting ruleset that almost every hand-written parser ignores . Three inputs break the naive version, and all three fail the same way: your columns silently shift by one. Case 1 — a comma inside quotes sku,name,price 00127,Widget, small,45.20 Naive line.split(',') gives you four fields for three columns. The price lands in a fourth…

CSV files have a complex quoting ruleset that many hand-written parsers ignore. There are three key inputs that break these parsers, causing columns to shift by one. Case 1 involves a comma inside quotes; this leads to a fourth column being created and the price disappearing. Case 2 occurs when doubled quotes are treated as an escape, not a close, resulting in the field being split incorrectly.

Case 3 introduces a Byte Order Mark (BOM) in UTF-8 files, causing the first header to become undefined in JSON. To resolve these issues, it is crucial to first strip the BOM, normalize line endings, split records respecting quotes across newlines, and then parse each record. These steps ensure proper mapping of the first row to headers and accurate conversion of CSV files to JSON.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

What broke when I moved Grafana Faro to OpenTelemetry JS 3.0

TL;DR: I opened the three PRs that move Grafana Faro's web SDK onto OpenTelemetry JS SDK 3.0. The version bump was the easy part.

  • Grafana Faro upgraded from 2.x to OpenTelemetry JS 3.0
  • Three pull requests created for transition, including version bump
  • Main challenge was imports into OTel packages, especially OTLP transformer

Your Playwright test is green. Your checkout is broken

Here is a Playwright test I've seen in almost every codebase I've worked on: test ( " places an order " , async ({ page }) => { await page . goto ( " / " ); await page . getByLabel ( " Name " ).

  • Playwright test passes despite API returning 500 error
  • Optimistic UI and error swallowing cause issue
  • Fix response, read data back, or implement safety net

The pause before the action: how Sakupa's confirmation step works

A quick disclosure first: I am not Sakupa's developer. I came across this MCP server while looking into how AI agents publish websites, and this post only organizes facts from its official site and official manual. This is not a hands-on review.

  • Sakupa pauses before website changes to show proposed modifications to users.
  • The confirmation step serves to validate edits, prevent errors, and maintain workflow consistency.
  • Designed for static sites, Sakupa lacks dynamic features like databases or login capabilities.

More from Wednesday 4 November →