I'm attempting to create a CSV file, but unfortunately, the file has a MIME type of text/plain. How can I change the MIME type to text/csv?
The MIME type of the result file is text/plain regardless of the extension that I give the file.
I've searched high and low for a solution, but haven't found one yet.
Any help is much appreciated. Thank you!
The file command inspects the content of the file to determine the type.
I don't know exactly what it looks for to identify a CSV file, but could it be that something like line-break characters are causing the difference? CSV (as defined by RFC4180) is supposed to use CRLF line breaks. I could imagine that whatever you have used to modify it has leniently accepted e.g. LF line breaks and saved it with the required CRLF. (Less likely with a "text editor" (be specific!!) and more likely with a spreadsheet.)
If you post the output of e.g. od -a | head for both files, maybe someone will spot the important difference.
Be aware that what the file command things may not be very important in general on MacOS; what Splotlight thinks makes more difference to e.g. Finder.
P.S. I suggest not posting comments on this forum - post replies. Comments don't seem to trigger emails to people who are watching the thread.