由 Excel 创建的以分号作为分隔符的 CSV 文件的正确 MIME 类型是什么
我在瑞士工作,那里的分号 ;
是 Windows 区域设置中的“官方”列表分隔符。
Excel 在创建 CSV 文件时使用此分隔符。
在 RFC 4180 中,CSV 文件被定义为以逗号分隔,并具有关联的 text/csv
mime 类型。我的文件不符合这个定义。
我使用 application/vnd.ms-excel
代替,但我不满意将其声明为“Excel”文件,因为它是一个独立于应用程序的分号分隔文件。
正确的 MIME 类型是什么?
谢谢!
I work in Switzerland, where the semicolon ;
is the "official" list separator in Windows' regional settings.
Excel uses this separator when creating CSV files.
In RFC 4180 the CSV file is defined as comma separated and has the mime type of text/csv
associated. My file does not conform to this definition.
I'm using application/vnd.ms-excel
instead, but I'm not satisfied by declaring it an "Excel" file, since it's an application independent semicolon-separated file.
What would the correct MIME type be?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AFAIK 对于分号分隔的文件没有官方的 mime 类型。这并不奇怪 - 例如,mime 类型也没有指定字符编码。
您可以简单地使用 text/plain (因为该文件毕竟只是一个文本文件),但我假设您想要使用特定的 mime 类型,因为您希望浏览器/操作系统在“适当的”应用程序中打开它。 (这种格式仅真正适合某种应用程序的处理)。
我认为在 90% 的情况下,合适的应用程序是 Excel。对于少数没有 Excel 但有 Excel-a-like 的用户,您可能会发现 Excel-a-like 应用程序将自身注册为能够使用 Excel 文件,因此它可能会按照您想要的方式工作?
AFAIK there is no official mime-type for a semicolon-separated file. This is not surprising - the mime type also does not specify the character-encoding, for example.
You could simply use text/plain (since the file is after all simply a text file), but I presume that you want to use a particular mime type because you want the browser/OS to open it in an "appropriate" application. (This format is only really suitable for processing by an application of some sort).
I would think that in 90% of cases that appropriate application will be Excel. For the few users who don't have Excel but do have an Excel-a-like, you may find that the Excel-a-like application registers itself as able to consume Excel files, and so it may all just work as you wanted?