Silent encoding bug corrupted emails for months without a single error log
A developer in Assis, São Paulo discovered that her system had been sending emails with garbled Portuguese accented characters due to a character encoding mismatch. The root cause was a script reading a UTF-8 CSV file using Latin-1 encoding — a combination that never threw errors because UTF-8 bytes read as Latin-1 form a stable round-trip, leaving the source file intact. The bug remained invisible for months since the file appeared correct when opened and no exceptions were raised during processing. Corruption only became visible when the misread text reached an output that properly decoded UTF-8, such as an email body or an LLM prompt. The fix required nothing more than changing encoding='latin1' to encoding='utf-8' at each point the file was opened, with no data rewriting needed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in