📄 rfc1896.txt
字号:
RFC 1896 text/enriched MIME Content-type February 1996 running margin. Nofill causes the affected text to be displayed without filling. That is, the text is displayed without using the rules for replacing CRLF pairs with spaces or removing consecutive sequences of CRLF pairs. However, the current state of the margins and justification is honored; any indentation or justification commands are still applied to the text within the scope of the "nofill". The "center", "flushleft", "flushright", and "flushboth" commands are mutually exclusive, and, when nested, the inner command takes precedence. The "nofill" command is mutually exclusive with the "in" and "out" parameters of the "paraindent" command; when they occur in the same scope, their behavior is undefined. The parameter data for the "paraindent" command may contain multiple occurances of the same parameter (i.e. "left", "right", "in", or "out"). Each occurance causes the text to be further indented in the manner indicated by that parameter. Nested "paraindent" commands cause the affected text to be further indented according to the parameters. Note that the "in" and "out" parameters for "paraindent" are mutually exclusive; when they appear together or when nested "paraindent" commands contain both of them, their behavior is undefined. For purposes of the "in" and "out" parameters, a paragraph is defined as text that is delimited by line breaks after applying the rules for replacing CRLF pairs with spaces or removing consecutive sequences of CRLF pairs. For example, within the scope of an "out", the line following each CRLF is made flush with the running margin, and subsequent lines are indented. Within the scope of an "in", the first line following each CRLF is indented, and subsequent lines remain flush to the running margin. Whether or not text is justified by default (that is, whether the default environment is "flushleft", "flushright", or "flushboth") is unspecified, and depends on the preferences of the user, the capabilities of the local software and hardware, and the nature of the character set in use. On systems where full justification is considered undesirable, the "flushboth" environment may be identical to the default environment. Note that full justification should never be performed inside of "center", "flushleft", "flushright", or "nofill" environments. Note also that for some non-ASCII character sets, full justification may be fundamentally inappropriate.Resnick & Walker Informational [Page 8]RFC 1896 text/enriched MIME Content-type February 1996 Note that [RFC-1563] defined two additional indentation commands, "Indent" and "IndentRight". These commands did not force a line break, and therefore their behavior was unpredictable since they depended on the margins and character sizes that a particular implementation used. Therefore, their use is deprecated and they should be ignored just as other unrecognized commands.Markup Commands Commands in this section, unlike the other text/enriched commands are declarative markup commands. Text/enriched is not intended as a full markup language, but instead as a simple way to represent common formatting commands. Therefore, markup commands are purposely kept to a minimum. It is only because each was deemed so prevalent or necessary in an e-mail environment that these particular commands have been included at all. Excerpt causes the affected text to be interpreted as a textual excerpt from another source, probably a message being responded to. Typically this will be displayed using indentation and an alternate font, or by indenting lines and preceding them with "> ", but such decisions are up to the implementation. Note that as with the justification commands, the excerpt command implicitly begins and ends with a line break if one is not already there. Nested "excerpt" commands are acceptable and should be interpreted as meaning that the excerpted text was excerpted from yet another source. Again, this can be displayed using additional indentation, different colors, etc. Optionally, the "excerpt" command can take a parameter by using the "param" command. The format of the data is unspecified, but it is intended to uniquely identify the text from which the excerpt is taken. With this information, an implementation should be able to uniquely identify the source of any particular excerpt, especially if two or more excerpts in the message are from the same source, and display it in some way that makes this apparent to the user. Lang causes the affected text to be interpreted as belonging to a particular language. This is most useful when two different languages use the same character set, but may require a different font or formatting depending on the language. For instance, Chinese and Japanese shareResnick & Walker Informational [Page 9]RFC 1896 text/enriched MIME Content-type February 1996 similar character glyphs, and in some character sets like UNICODE share common code points, but it is considered very important that different fonts be used for the two languages, especially if they appear together, so that meaning is not lost. Also, language information can be used to allow for fancier text handling, like spell checking or hyphenation. The "lang" command requires a parameter using the "param" command. The parameter data can be any of the language tags specified in [RFC-1766], "Tags for the Identification of Languages". These tags are the two letter language codes taken from [ISO-639] or can be other language codes that are registered according to the instructions in the Langauge Tags RFC. Consult that memo for further information.Balancing and Nesting of Formatting Commands Pairs of formatting commands must be properly balanced and nested. Thus, a proper way to describe text in bold italics is: <bold><italic>the-text</italic></bold> or, alternately, <italic><bold>the-text</bold></italic> but, in particular, the following is illegal text/enriched: <bold><italic>the-text</bold></italic> The nesting requirement for formatting commands imposes a slightly higher burden upon the composers of text/enriched bodies, but potentially simplifies text/enriched displayers by allowing them to be stack-based. The main goal of text/enriched is to be simple enough to make multifont, formatted email widely readable, so that those with the capability of sending it will be able to do so with confidence. Thus slightly increased complexity in the composing software was deemed a reasonable tradeoff for simplified reading software. Nonetheless, implementors of text/enriched readers are encouraged to follow the general Internet guidelines of being conservative in what you send and liberal in what you accept. Those implementations that can do so are encouraged to deal reasonably with improperly nested text/enriched data.Resnick & Walker Informational [Page 10]RFC 1896 text/enriched MIME Content-type February 1996Unrecognized formatting commands Implementations must regard any unrecognized formatting command as "no-op" commands, that is, as commands having no effect, thus facilitating future extensions to "text/enriched". Private extensions may be defined using formatting commands that begin with "X-", by analogy to Internet mail header field names. In order to formally define extended commands, a new Internet document should be published.White Space in Text/enriched Data No special behavior is required for the SPACE or TAB (HT) character. It is recommended, however, that, at least when fixed-width fonts are in use, the common semantics of the TAB (HT) character should be observed, namely that it moves to the next column position that is a multiple of 8. (In other words, if a TAB (HT) occurs in column n, where the leftmost column is column 0, then that TAB (HT) should be replaced by 8-(n mod 8) SPACE characters.) It should also be noted that some mail gateways are notorious for losing (or, less commonly, adding) white space at the end of lines, so reliance on SPACE or TAB characters at the end of a line is not recommended.Initial State of a text/enriched interpreter Text/enriched is assumed to begin with filled text in a variable- width font in a normal typeface and a size that is average for the current display and user. The left and right margins are assumed to be maximal, that is, at the leftmost and rightmost acceptable positions.Non-ASCII character sets One of the great benefits of MIME is the ability to use different varieties of non-ASCII text in messages. To use non-ASCII text in a message, normally a charset parameter is specified in the Content- type line that indicates the character set being used. For purposes of this RFC, any legal MIME charset parameter can be used with the text/enriched Content-type. However, there are two difficulties that arise with regard to the text/enriched Content-type when non-ASCII text is desired. The first problem involves difficulties that occur when the user wishes to create text which would normally require multiple non-ASCII character sets in the same text/enriched message. The second problem is an ambiguity that arises because of the text/enriched use of the "<" character in formatting commands.Resnick & Walker Informational [Page 11]RFC 1896 text/enriched MIME Content-type February 1996Using multiple non-ASCII character sets Normally, if a user wishes to produce text which contains characters from entirely different character sets within the same MIME message (for example, using Russian Cyrillic characters from ISO 8859-5 and Hebrew characters from ISO 8859-8), a multipart message is used. Every time a new character set is desired, a new MIME body part is started with different character sets specified in the charset parameter of the Content-type line. However, using multiple character sets this way in text/enriched messages introduces problems. Since a change in the charset parameter requires a new part, text/enriched formatting commands used in the first part would not be able to apply to text that occurs in subsequent parts. It is not possible for text/enriched formatting commands to apply across MIME body part boundaries. [RFC-1341] attempted to get around this problem in the now obsolete text/richtext format by introducing different character set formatting commands like "iso-8859-5" and "us-ascii". But this, or even a more general solution along the same lines, is still undesirable: It is common for a MIME application to decide, for example, what character font resources or character lookup tables it will require based on the information provided by the charset parameter of the Content-type line, before it even begins to interpret or display the data in that body part. By allowing the text/enriched interpreter to subsequently change the character set, perhaps to one completely different from the charset specified in the Content-type line (with potentially much different resource requirements), too much burden would be placed on the text/enriched interpreter itself. Therefore, if multiple types of non-ASCII characters are desired in a text/enriched document, one of the following two methods must be used: 1. For cases where the different types of non-ASCII text can be limited to their own paragraphs with distinct formatting, a multipart message can be used with each part having a Content-Type of text/enriched and a different charset parameter. The one caveat to using this method is that each new part must start in the initial state for a text/enriched document. That means that all of the text/enriched commands in the preceding part must be properly balanced with ending commands before the next text/enriched part begins. Also, each text/enriched part must begin a new paragraph.Resnick & Walker Informational [Page 12]RFC 1896 text/enriched MIME Content-type February 1996 2. If different types of non-ASCII text are to appear in the same line or paragraph, or if text/enriched formatting (e.g. margins, typeface, justification) is required across several different types of non-ASCII text, a single text/enriched body part should be used with a character set specified that contains all of the required characters. For example, a charset parameter of "UNICODE-1-1-UTF-7" as specified in [RFC-1642] could be used for such purposes. Not only does UNICODE contain all of the characters that can be represented in all of the other registered ISO 8859 MIME character sets, but UTF-7 is fully compatible with other aspects of the text/enriched standard, including the use of the "<" character referred to below. Any other character sets that are specified for use in MIME which contain different types of non-ASCII text can also be used in these instances.Use of the "<" character in formatting commands If the character set specified by the charset parameter on the Content-type line is anything other than "US-ASCII", this means that the text being described by text/enriched formatting commands is in a non-ASCII character set. However, the commands themselves are still the same ASCII commands that are defined in this document. This creates an ambiguity only with reference to the "<" character, the octet with numeric value 60. In single byte character sets, such as the ISO-8859 family, this is not a problem; the octet 60 can be quoted by including it twice, just as for ASCII. The problem is more complicated, however, in the case of multi-byte character sets, where the octet 60 might appear at any point in the byte sequence for any of several characters. In practice, however, most multi-byte character sets address this problem internally. For example, the UNICODE character sets can use the UTF-7 encoding which preserves all of the important ASCII characters in their single byte form. The ISO-2022 family of character sets can use certain character sequences to switch back into ASCII at any moment. Therefore it is specified that, before text/enriched formatting commands, the prevailing character set should be "switched back" into ASCII, and that only those characters which would be interpreted as "<" in plain text should be interpreted as token delimiters in text/enriched. The question of what to do for hypothetical future character sets that do not subsume ASCII is not addressed in this memo.Resnick & Walker Informational [Page 13]RFC 1896 text/enriched MIME Content-type February 1996Minimal text/enriched conformance A minimal text/enriched implementation is one that converts "<<" to "<", removes everything between a <param> command and the next balancing </param> command, removes all other formatting commands (all text enclosed in angle brackets), and, outside of <nofill> environments, converts any series of n CRLFs to n-1 CRLFs, and converts any lone CRLF pairs to SPACE.Notes for Implementors It is recognized that implementors of future mail systems will want rich text functionality far beyond that currently defined for text/enriched. The intent of text/enriched is to provide a common format for expressing that functionality in a form in which much of it, at least, will be understood by interoperating software. Thus, in particular, software with a richer notion of formatted text than text/enriched can still use text/enriched as its basic representation, but can extend it with new formatting commands and by hiding information specific to that software system in text/enriched <param> constructs. As such systems evolve, it is expected that the definition of text/enriched will be further refined by future published specifications, but text/enriched as defined here provides a platform on which evolutionary refinements can be based. An expected common way that sophisticated mail programs will generate text/enriched data is as part of a multipart/alternative construct. For example, a mail agent that can generate enriched mail in ODA format can generate that mail in a more widely interoperable form by generating both text/enriched and ODA versions of the same data, e.g.: Content-type: multipart/alternative; boundary=foo --foo Content-type: text/enriched [text/enriched version of data] --foo Content-type: application/oda [ODA version of data] --foo-- If such a message is read using a MIME-conformant mail reader that understands ODA, the ODA version will be displayed; otherwise, the text/enriched version will be shown.Resnick & Walker Informational [Page 14]RFC 1896 text/enriched MIME Content-type February 1996
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -