Html 简明教程

MIME Media Types

MIME(多用途互联网邮件扩展)媒体类型最初是为了让电子邮件包含纯文本之外的信息而设计的。MIME 媒体类型指示以下内容:

MIME (Multi-purpose Internet Mail Extension) media types were originally devised so that e-mails could include information other than plain text. MIME media types indicate the following things −

  1. How different parts of a message, such as text and attachments, are combined into the message.

  2. The way in which each part of the message is specified.

  3. The way different items are encoded for transmission so that even software that was designed to work only with ASCII text can process the message.

现在 MIME 类型不仅可用于电子邮件;它们已被 Web 服务器采用,作为一种告诉 Web 浏览器向它们发送哪种类型的材料的方式,以便它们能够正确地处理这种类型的消息。

Now MIME types are not just for use with e-mail; they have been adopted by Web servers as a way to tell Web browsers what type of material was being sent to them so that they can cope with that kind of messages correctly.

MIME 内容类型由两部分组成 −

MIME content types consist of two parts −

  1. A main type

  2. A sub-type

主类型由斜杠字符与子类型分隔。例如,HTML 为 text/html。

The main type is separated from the subtype by a forward slash character. For example, text/html for HTML.

本章按照主类型组织 −

This chapter is organized for the main types −

例如,text 主类型包含纯文本文件类型,例如 −

For example, the text main type contains types of plain text files, such as −

  1. text/plain for plain text files

  2. text/html for HTML files

  3. text/rtf for text files using rich text formatting

MIME 类型由互联网号码分配机构 (IANA) 正式分配和列出。

MIME types are officially supposed to be assigned and listed by the Internet Assigned Numbers Authority (IANA).

此列表中的许多常用 MIME 类型(所有以“x-”开头)未由 IANA 分配,并且没有官方状态。您可以在 [role="bare"] [role="bare"]http://www.iana.org/assignments/media-types/ 查看官方 MIME 类型的列表。以 .vnd 为前缀的那些是特定于供应商的。

Many of the popular MIME types in this list (all those begin with "x-") are not assigned by the IANA and do not have official status. You can see the list of official MIME types at [role="bare"]http://www.iana.org/assignments/media-types/. Those preceded with .vnd are vendorspecific.

在指定内容类型字段的 MIME 类型时,您还可以指示所用文本的字符集。如果您未指定字符集,则默认为 US-ASCII。例如 −

When specifying the MIME type of a content-type field you can also indicate the character set for the text being used. If you do not specify a character set, the default is US-ASCII. For example −

content-type:text/plain; charset=iso-8859-1