Sometimes you wonder what century we’re living in. Things that should be simple and ‘just work’ often don’t.
I whipped up a quick CSV export function, which results in files such as:
"name","department","phone" "john smith","accounting","555 1234"
Pretty standard. UTF-8. Double quotes (
") in fields repeated (
"") to escape them. Works fine in Apple Numbers, Excel for Mac and my Excel 2007 on Windows XP (VMWare).
However, a coworker was unable to open the files. Also using Excel 2007, on Vista in this case. After many fruitless attempts changing the format, such as unquoting certain fields, changing line endings to
\r\n/, it appears that a Dutch Excel 2007 handles CSV files differently than a US Excel 2007… The European localized version only accepts fields terminated by semicolons, whilst the US version needs fields terminated by commas.
This makes CSV export for Excel impossible to create reliably, unless you add some sort of radio button to ask if somebody runs a US or European version of Excel. Or if you do some browser header sniffing and hopes that this person doesn’t run the browser in a different language than Excel… (which is quite often the case in The Netherlands).
Only resort – add an extra button: Export to Excel XML. Gahhhhh…
Anyway, I hope this post is helpful for someone who runs into the same problem as I did.