What MIME type should I use for CSV?

I've seen application/csv used and also text/csv .

What's the difference? Is there a difference? Does it matter which as long as the request matches something that's available? Are they interchangeable?


RFC 7111

There is an RFC which covers it and says to use text/csv .

This RFC updates RFC 4180.


Excel

Recently I discovered an explicit mimetype for Excel application/vnd.ms-excel. It was registered with Iana in '96. Note the concerns raised about being at the mercy of the sender and having your machine violated.

Media Type: application/vnd.ms-excel

Name Microsoft Excel (tm)

Required parameters: None

Optional parameters: name

Encoding considerations: base64 preferred

Security considerations: As with most application types this data is intended for interpretation by a program that understands the data on the recipient's system. Recipients need to understand that they are at the "mercy" of the sender, when receiving this type of data, since data will be executed on their system, and the security of their machines can be violated.

OID { org-id ms-files(4) ms-excel (3) }

Object type spreadsheet

Comments This Media Type/OID is used to identify Microsoft Excel generically (ie, independent of version, subtype, or platform format).

I wasn't aware that vendor extensions were allowed. Check out this answer to find out more - thanks starbeamrainbowlabs for the reference.


您应该根据RFC 4180使用“text / csv”。


Strange behavior with MS Excel : If i export to "text based, comma-separated format ( csv )" this is the mime-type I get after uploading on my webserver:

[name] => data.csv
[type] => application/vnd.ms-excel

So Microsoft seems to be doing own things again, regardless of existing standards: https://en.wikipedia.org/wiki/Comma-separated_values

链接地址: http://www.djcxy.com/p/7940.html

上一篇: 使用Apache tika获取MimeType子类型

下一篇: 我应该使用哪种MIME类型的CSV?