Skip to content

Instantly share code, notes, and snippets.

@mandrean
Created September 1, 2015 14:15
Show Gist options
  • Save mandrean/c447989cb17732d7a225 to your computer and use it in GitHub Desktop.
Save mandrean/c447989cb17732d7a225 to your computer and use it in GitHub Desktop.
Fix broken CSV encoding in Excel for Mac

Fix broken CSV encoding in Excel for Mac

Problem

Excel for Mac can't handle UTF-8 encoded CSV files. Official statement by Microsoft:

Excel for Mac does not currently support UTF-8. If this is a feature you’d like to see in future versions of Office for Mac, be sure to send your feedback by clicking “Help” > “Send Feedback” [...]

Solution

Convert the UTF-8 file to UTF-16 Little Endian by running this one-liner in Terminal:

( printf "\xff\xfe" ; iconv -f utf-8 -t utf-16le INPUT_UTF8_FILE.csv ) > OUTPUT_UTF16_FILE.csv

Voila!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment