Today I Learned: Finding .csv encodings in Emacs
I was trying to load some .csv export from my bank into a Pandas dataframe to do a bit of digging
into my finances. However, I couldn't load it due to decoding errors and none of the typical
encodings didn't help. ChatGPT was also not of any help1. Emacs came to the rescue. I just
opened the .csv file in Emacs and checked the buffer variable buffer-file-coding-system
, whose
value you can check using the keybinding C-h v
. Turns out the encoding I needed was
UTF-16LE. Fixing that, pd.read_csv
worked like a charm.
Footnotes:
1
Interesting that I reach to ChatGPT now. I just pasted some rows of the .csv file and asked for a parsing function with the correct encoding.