Why a Base64 CSV starts with 77u/ and its first column looks wrong
A UTF-8 byte order mark can become an invisible character in the first column name. Compare a two-byte header with its five-byte counterpart.
Look at the first column name
Some readers consume a UTF-8 BOM at the start of a file. Others leave a leading U+FEFF in the decoded string. In the latter case, a column can display as id while a lookup for the two-character string id fails.
Compare the original file bytes
Adding EF BB BF before the letters id changes the decoded length from two to five bytes. It also makes the Base64 start with 77u/. A text preview may hide the difference. Restore the file as bytes and inspect the first three before editing the CSV.
| Input | Bytes in hexadecimal | Base64 |
|---|---|---|
id | 69 64 | aWQ= |
BOM + id | EF BB BF 69 64 | 77u/aWQ= |
Handle the marker when opening the CSV
In Python, open(path, encoding="utf-8-sig", newline="") consumes an initial BOM when present. Keep the source file untouched if its checksum matters. Replacing every U+FEFF in the text would also affect occurrences away from the start of the file.