Browsers open PHP generated tab delimited file with quicktime, instead of inline inside the browser
We are creating various CSV files with PHP. We have one CSV file, that uses iconv encoding in order to display Japanese characters, this file is also tab delimited, and not comma delimited, but is still saved with a '.csv' extension. This doesn't bother excel at all. Problem is, when we try to open this CSV file via a url, inline in the browser, the browser tries to open it using Quicktime.
This happens regardless whether the file is comma or tab delimited, it seems that the problem is the the japanese character encoding. I include a snippet of what our encoding code looks like, nothing special actually.
I have tried saving it as a txt file, but then it looses its Japanese character encoding.
Does anyone know how we can solve this?
$string= chr(255).chr(254).iconv ( 'UTF-8', 'UTF-16LE', "some japanese characters");
header('Content-Type: text/csv');