I needed to generate an Excel friendly CSV file from a bunch of UTF-8 encoded data, coming from a database. I could generate the file just fine and it looked OK in vi or TextMate but when opened in Excel all of my diacritics (umlauts, etc) would be rendered as gibberish. Which made me think it was more of an Excel issue, because they appeared fine in TextMate, for example.
The answer ended up being two-fold:
- Use a tab delimiter instead of a comma
- Use Iconv to force your string to be UTF-16
Both of these seemed to be required. Why the tab delimiter was crucial I have no idea, chalk it up to MS.