views:

904

answers:

2

I've come across the problem where Excel will not play nice with UTF-8 encoded CSV files. See this related question on Stack Overflow.

I've followed the solution of exporting as UTF-16, however it seems that with UTF-16, the comma character doesn't work as a delimiter, only the tab character.

However I can't find anywhere what the correct filename and mime-type should be for tab-delimited files. I found somewhere stating that it was application/vnd.ms-excel and xls. This works ok for Excel 2003 but 2007 does not approve.

So what should it be?

+1  A: 

For tab-delimited files, http://www.rfc-editor.org/rfc/rfc4180.txt mentions 'text/tab-delimited-values'.

That format is (sparsely) described at http://www.iana.org/assignments/media-types/text/tab-separated-values.

More info can be found at : http://www.cs.tut.fi/~jkorpela/TSV.html

I hope this helps?

PatrickvL
Thanks, probably that is what it SHOULD work like, but excel has no understanding of that mime-type whatsoever.
EvilPuppetMaster
A: 

Mime-type is an HTTP thing and only has meaning to the browser - it is not saved along with the file when you download a local copy. So Excel doesn't ever see your mime-type.

hristo