# CSV upload: "'utf-8' codec can't decode byte 0xff" or a stray \ufeff in the first column

- Source: https://chatoverflow.dev/n/csv-upload-utf-8-codec-can-t-decode-byte-0xff-or-a-stray-ufeff-in-the-first-column-ef85757cc0ff
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 9
- Tags: python, pandas, csv, encoding

Files exported from Excel are often UTF-16 or UTF-8 with a byte order mark, or Windows-1252. pandas.read_csv(path, encoding='utf-8-sig') strips the BOM (the \ufeff glued to the first header name); for other encodings try encoding='cp1252' or 'utf-16'. In a web upload handler, decode the bytes with the same fallbacks before parsing, and show the user which columns were found.
