📄 rfc2045.txt
字号:
The term "character set" is used in MIME to refer to a method of
converting a sequence of octets into a sequence of characters. Note
that unconditional and unambiguous conversion in the other direction
is not required, in that not all characters may be representable by a
given character set and a character set may provide more than one
sequence of octets to represent a particular sequence of characters.
This definition is intended to allow various kinds of character
encodings, from simple single-table mappings such as US-ASCII to
complex table switching methods such as those that use ISO 2022's
techniques, to be used as character sets. However, the definition
associated with a MIME character set name must fully specify the
mapping to be performed. In particular, use of external profiling
information to determine the exact mapping is not permitted.
NOTE: The term "character set" was originally to describe such
straightforward schemes as US-ASCII and ISO-8859-1 which have a
simple one-to-one mapping from single octets to single characters.
Multi-octet coded character sets and switching techniques make the
situation more complex. For example, some communities use the term
"character encoding" for what MIME calls a "character set", while
using the phrase "coded character set" to denote an abstract mapping
from integers (not octets) to characters.
2.3. Message
The term "message", when not further qualified, means either a
(complete or "top-level") RFC 822 message being transferred on a
network, or a message encapsulated in a body of type "message/rfc822"
or "message/partial".
2.4. Entity
The term "entity", refers specifically to the MIME-defined header
fields and contents of either a message or one of the parts in the
body of a multipart entity. The specification of such entities is
the essence of MIME. Since the contents of an entity are often
called the "body", it makes sense to speak about the body of an
entity. Any sort of field may be present in the header of an entity,
but only those fields whose names begin with "content-" actually have
any MIME-related meaning. Note that this does NOT imply thay they
have no meaning at all -- an entity that is also a message has non-
MIME header fields whose meanings are defined by RFC 822.
Freed & Borenstein Standards Track [Page 6]
RFC 2045 Internet Message Bodies November 1996
2.5. Body Part
The term "body part" refers to an entity inside of a multipart
entity.
2.6. Body
The term "body", when not further qualified, means the body of an
entity, that is, the body of either a message or of a body part.
NOTE: The previous four definitions are clearly circular. This is
unavoidable, since the overall structure of a MIME message is indeed
recursive.
2.7. 7bit Data
"7bit data" refers to data that is all represented as relatively
short lines with 998 octets or less between CRLF line separation
sequences [RFC-821]. No octets with decimal values greater than 127
are allowed and neither are NULs (octets with decimal value 0). CR
(decimal value 13) and LF (decimal value 10) octets only occur as
part of CRLF line separation sequences.
2.8. 8bit Data
"8bit data" refers to data that is all represented as relatively
short lines with 998 octets or less between CRLF line separation
sequences [RFC-821]), but octets with decimal values greater than 127
may be used. As with "7bit data" CR and LF octets only occur as part
of CRLF line separation sequences and no NULs are allowed.
2.9. Binary Data
"Binary data" refers to data where any sequence of octets whatsoever
is allowed.
2.10. Lines
"Lines" are defined as sequences of octets separated by a CRLF
sequences. This is consistent with both RFC 821 and RFC 822.
"Lines" only refers to a unit of data in a message, which may or may
not correspond to something that is actually displayed by a user
agent.
Freed & Borenstein Standards Track [Page 7]
RFC 2045 Internet Message Bodies November 1996
3. MIME Header Fields
MIME defines a number of new RFC 822 header fields that are used to
describe the content of a MIME entity. These header fields occur in
at least two contexts:
(1) As part of a regular RFC 822 message header.
(2) In a MIME body part header within a multipart
construct.
The formal definition of these header fields is as follows:
entity-headers := [ content CRLF ]
[ encoding CRLF ]
[ id CRLF ]
[ description CRLF ]
*( MIME-extension-field CRLF )
MIME-message-headers := entity-headers
fields
version CRLF
; The ordering of the header
; fields implied by this BNF
; definition should be ignored.
MIME-part-headers := entity-headers
[ fields ]
; Any field not beginning with
; "content-" can have no defined
; meaning and may be ignored.
; The ordering of the header
; fields implied by this BNF
; definition should be ignored.
The syntax of the various specific MIME header fields will be
described in the following sections.
4. MIME-Version Header Field
Since RFC 822 was published in 1982, there has really been only one
format standard for Internet messages, and there has been little
perceived need to declare the format standard in use. This document
is an independent specification that complements RFC 822. Although
the extensions in this document have been defined in such a way as to
be compatible with RFC 822, there are still circumstances in which it
might be desirable for a mail-processing agent to know whether a
message was composed with the new standard in mind.
Freed & Borenstein Standards Track [Page 8]
RFC 2045 Internet Message Bodies November 1996
Therefore, this document defines a new header field, "MIME-Version",
which is to be used to declare the version of the Internet message
body format standard in use.
Messages composed in accordance with this document MUST include such
a header field, with the following verbatim text:
MIME-Version: 1.0
The presence of this header field is an assertion that the message
has been composed in compliance with this document.
Since it is possible that a future document might extend the message
format standard again, a formal BNF is given for the content of the
MIME-Version field:
version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
Thus, future format specifiers, which might replace or extend "1.0",
are constrained to be two integer fields, separated by a period. If
a message is received with a MIME-version value other than "1.0", it
cannot be assumed to conform with this document.
Note that the MIME-Version header field is required at the top level
of a message. It is not required for each body part of a multipart
entity. It is required for the embedded headers of a body of type
"message/rfc822" or "message/partial" if and only if the embedded
message is itself claimed to be MIME-conformant.
It is not possible to fully specify how a mail reader that conforms
with MIME as defined in this document should treat a message that
might arrive in the future with some value of MIME-Version other than
"1.0".
It is also worth noting that version control for specific media types
is not accomplished using the MIME-Version mechanism. In particular,
some formats (such as application/postscript) have version numbering
conventions that are internal to the media format. Where such
conventions exist, MIME does nothing to supersede them. Where no
such conventions exist, a MIME media type might use a "version"
parameter in the content-type field if necessary.
Freed & Borenstein Standards Track [Page 9]
RFC 2045 Internet Message Bodies November 1996
NOTE TO IMPLEMENTORS: When checking MIME-Version values any RFC 822
comment strings that are present must be ignored. In particular, the
following four MIME-Version fields are equivalent:
MIME-Version: 1.0
MIME-Version: 1.0 (produced by MetaSend Vx.x)
MIME-Version: (produced by MetaSend Vx.x) 1.0
MIME-Version: 1.(produced by MetaSend Vx.x)0
In the absence of a MIME-Version field, a receiving mail user agent
(whether conforming to MIME requirements or not) may optionally
choose to interpret the body of the message according to local
conventions. Many such conventions are currently in use and it
should be noted that in practice non-MIME messages can contain just
about anything.
It is impossible to be certain that a non-MIME mail message is
actually plain text in the US-ASCII character set since it might well
be a message that, using some set of nonstandard local conventions
that predate MIME, includes text in another character set or non-
textual data presented in a manner that cannot be automatically
recognized (e.g., a uuencoded compressed UNIX tar file).
5. Content-Type Header Field
The purpose of the Content-Type field is to describe the data
contained in the body fully enough that the receiving user agent can
pick an appropriate agent or mechanism to present the data to the
user, or otherwise deal with the data in an appropriate manner. The
value in this field is called a media type.
HISTORICAL NOTE: The Content-Type header field was first defined in
RFC 1049. RFC 1049 used a simpler and less powerful syntax, but one
that is largely compatible with the mechanism given here.
The Content-Type header field specifies the nature of the data in the
body of an entity by giving media type and subtype identifiers, and
by providing auxiliary information that may be required for certain
media types. After the media type and subtype names, the remainder
of the header field is simply a set of parameters, specified in an
attribute=value notation. The ordering of parameters is not
significant.
Freed & Borenstein Standards Track [Page 10]
RFC 2045 Internet Message Bodies November 1996
In general, the top-level media type is used to declare the general
type of data, while the subtype specifies a specific format for that
type of data. Thus, a media type of "image/xyz" is enough to tell a
user agent that the data is an image, even if the user agent has no
knowledge of the specific image format "xyz". Such information can
be used, for example, to decide whether or not to show a user the raw
data from an unrecognized subtype -- such an action might be
reasonable for unrecognized subtypes of text, but not for
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -