As per Relevance of the word september, we have this rfc below:
Network Working Group K.
Request for Comments: 1522 University of
Obsoletes: 1342 September 1993
Category: Standards
MIME (Multipurpose Internet Mail Extensions) Part Two
Message Header Extensions for Non-ASCII
Status of this
This RFC specifies an Internet standards track protocol for
Internet community, and requests discussion and suggestions
improvements. Please refer to the current edition of the "
Official Protocol Standards" for the standardization state and
of this protocol. Distribution of this memo is unlimited
This memo describes an extension to the message format defined in
1521 [1], to allow the representation of character sets other
ASCII in RFC 822 (STD 11) message headers. The extensions
were designed to be highly compatible with existing Internet
handling software, and to be easily implemented in mail readers
support RFC 1521.
1.
RFC 1521 describes a mechanism for denoting textual body parts
are coded in various character sets, as well as methods for
such body parts as sequences of printable ASCII characters.
memo describes similar techniques to allow the encoding of non-
text in various portions of a RFC 822 [2] message header, in a
which is unlikely to confuse existing message handling software
Like the encoding techniques described in RFC 1521, the
outlined here were designed to allow the use of non-ASCII
in message headers in a way which is unlikely to be disturbed by
quirks of existing Internet mail handling programs. In particular
some mail relaying programs are known to (a) delete some
header fields while retaining others, (b) rearrange the order
addresses in To or Cc fields, (c) rearrange the (vertical) order
header fields, and/or (d) "wrap" message headers at different
than those in the original message. In addition, some mail
programs are known to have difficulty correctly parsing
headers which, while legal according to RFC 822, make use
backslash-quoting to "hide" special characters such as "<", ",",
":", or which exploit other infrequently-used features of
Moore [Page 1]
RFC 1522 MIME Part Two September 1993
specification
While it is unfortunate that these programs do not
interpret RFC 822 headers, to "break" these programs would
severe operational problems for the Internet mail system.
extensions described in this memo therefore do not rely on little
used features of RFC 822.
Instead, certain sequences of "ordinary" printable ASCII
(known as "encoded-words") are reserved for use as encoded data.
syntax of encoded-words is such that they are unlikely
"accidentally" appear as normal text in message headers
Furthermore, the characters used in encoded-words are restricted
those which do not have special meanings in the context in which
encoded-word appears
Generally, an "encoded-word" is a sequence of printable
characters that begins with "=?", ends with "?=", and has two "?"s
between. It specifies a character set and an encoding method,
also includes the original text encoded as graphic ASCII characters
according to the rules for that encoding method
A mail composer that implements this specification will provide
means of inputting non-ASCII text in header fields, but
translate these fields (or appropriate portions of these fields)
encoded-words before inserting them into the message header
A mail reader that implements this specification will
encoded-words when they appear in certain portions of the
header. Instead of displaying the encoded-word "as is", it
reverse the encoding and display the original text in the
character set
This memo relies heavily on notation and terms defined STD 11,
822 and RFC 1521. In particular, the syntax for the ABNF used
this memo is defined in STD 11, RFC 822, as well as many of
terms used in the grammar for the header extensions defined here
Successful implementation of this protocol extension
careful attention to the details of both STD 11, RFC 822 and
1521.
When the term "ASCII" appears in this memo, it refers to the "7-
Bit American Standard Code for Information Interchange",
X3.4-1986. The MIME charset name for this character set is "US
ASCII". When not specifically referring to the MIME charset name
this document uses the term "ASCII", both for brevity and
Moore [Page 2]
RFC 1522 MIME Part Two September 1993
consistency with STD 11, RFC 822. However, implementors
warned that the character set name must be spelled "US-ASCII"
MIME message and body part headers
2. Syntax of encoded-
An "encoded-word" is defined by the following ABNF grammar.
notation of RFC 822 is used, with the exception that white
characters MAY NOT appear between components of an encoded-word
encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
charset = token ; see section 3
encoding = token ; see section 4
token = 1*
especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "
<"> / "/" / "[" / "]" / "?" / "." / "="
encoded-text = 1*printable ASCII character
than "?" or SPACE
; (but see "Use of encoded-words in
; headers", section 5)
Both "encoding" and "charset" names are case-independent. Thus
charset name "ISO-8859-1" is equivalent to "iso-8859-1", and
encoding named "Q" may be spelled either "Q" or "q".
An encoded-word may not be more than 75 characters long,
charset, encoding, encoded-text, and delimiters. If it is
to encode more text than will fit in an encoded-word of 75
characters, multiple encoded-words (separated by CRLF SPACE) may
used
While there is no limit to the length of a multiple-line
field, each line of a header field that contains one or
encoded-words is limited to 76 characters
The length restrictions are included not only to
interoperability through internetwork mail gateways, but also
impose a limit on the amount of lookahead a header parser must
(while looking for a final ?= delimiter) before it can decide
a token is an encoded-word or something else
The characters which may appear in encoded-text are
restricted by the rules in section 5.
Moore [Page 3]
RFC 1522 MIME Part Two September 1993
3. Character
The "charset" portion of an encoded-word specifies the character
associated with the unencoded text. A charset can be any of
character set names allowed in an RFC 1521 "charset" parameter of
"text/plain" body part, or any character set name registered
IANA for use with the MIME text/plain content-type [3]. (See
7.1.1 of RFC 1521 for a list of charsets defined in that document).
Some character sets use code-switching techniques to switch
"ASCII mode" and other modes. If unencoded text in an encoded-
contains control codes to switch out of ASCII mode, it must
contain additional control codes such that ASCII mode is
selected at the end of the encoded-word. (This rule
separately to each encoded-word, including adjacent encoded-
within a single header field.)
When there is a possibility of using more than one character set
represent the text in an encoded-word, and in the absence of
agreements between sender and recipients of a message, it
recommended that members of the ISO-8859-* series be used
preference to other character sets
4.
Initially, the legal values for "encoding" are "Q" and "B".
encodings are described below. The "Q" encoding is recommended
use when most of the characters to be encoded are in the
character set; otherwise, the "B" encoding should be used
Nevertheless, a mail reader which claims to recognize encoded-
MUST be able to accept either encoding for any character set which
supports
Only a subset of the printable ASCII characters may be used
encoded-text. Space and tab characters are not allowed, so that
beginning and end of an encoded-word are obvious. The "?"
is used within an encoded-word to separate the various portions
the encoded-word from one another, and thus cannot appear in
encoded-text portion. Other characters are also illegal in
contexts. For example, an encoded-word in a "phrase" preceding
address in a From header field may not contain any of the "specials
defined in RFC 822. Finally, certain other characters are
in some contexts, to ensure reliability for messages that
through internetwork mail gateways
The "B" encoding automatically meets these requirements. The "Q
encoding allows a wide range of printable characters to be used
non-critical locations in the message header (e.g., Subject),
Moore [Page 4]
RFC 1522 MIME Part Two September 1993
fewer characters available for use in other locations
4.1. The "B"
The "B" encoding is identical to the "BASE64" encoding defined by
1521.
4.2. The "Q"
The "Q" encoding is similar to the "Quoted-Printable" content
transfer-encoding defined in RFC 1521. It is designed to allow
containing mostly ASCII characters to be decipherable on an
terminal without decoding
(1) Any 8-bit value may be represented by a "=" followed by
hexadecimal digits. For example, if the character set in
were ISO-8859-1, the "=" character would thus be encoded
"=3D", and a SPACE by "=20". (Upper case should be used
hexadecimal digits "A" through "F".)
(2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may
represented as "_" (underscore, ASCII 95.). (This character
not pass through some internetwork mail gateways, but its
will greatly enhance readability of "Q" encoded data with
readers that do not support this encoding.) Note that the "_"
always represents hexadecimal 20, even if the SPACE
occupies a different code position in the character set in use
(3) 8-bit values which correspond to printable ASCII characters
than "=", "?", "_" (underscore), and SPACE may be represented
those characters. (But see section 5 for restrictions.)
5. Use of encoded-words in message
An encoded-word may appear in a message header or body part
according to the following rules
(1) An encoded-word may replace a "text" token (as defined by
822) in any Subject or Comments header field, any
message header field, or any RFC 1521 body part field for
the field body is defined as "*text". An encoded-word may
appear in any user-defined ("X-") message or body part
field
Ordinary ASCII text and encoded-words may appear together in
same header field. However, an encoded-word that appears in
header field defined as "*text" MUST be separated from
adjacent encoded-word or "text" by linear-white-space
Moore [Page 5]
RFC 1522 MIME Part Two September 1993
(2) An encoded-word may appear within a comment delimited by "("
")", i.e., wherever a "ctext" is allowed. More precisely,
RFC 822 ABNF definition for "comment" is amended as follows
comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")"
A "Q"-encoded encoded-word which appears in a comment MUST
contain the characters "(", ")" or " encoded-word that appears
a "comment" MUST be separated from any adjacent encoded-word
"ctext" by linear-white-space
(3) As a replacement for a "word" entity within a "phrase",
example, one that precedes an address in a From, To, or
header. The ABNF definition for phrase from RFC 822
becomes
phrase = 1*(encoded-word / word
In this case the set of characters that may be used in a "Q"-
encoded encoded-word is restricted to:
ASCII letters, decimal digits, "!", "*", "+", "-", "/", "=",
"_" (underscore, ASCII 95.)>. An encoded-word that
within a "phrase" MUST be separated from any adjacent "word",
"text" or "special" by linear-white-space
These are the ONLY locations where an encoded-word may appear.
particular, an encoded-word MUST NOT appear in any portion of
"addr-spec". In addition, an encoded-word MUST NOT be used in
Received header field
Each encoded-word MUST encode an integral number of octets.
encoded-text in each encoded-word must be well-formed according
the encoding specified; the encoded-text may not be continued in
next encoded-word. (For example, "=?charset?Q?=?= =?charset?Q?AB?="
would be illegal, because the two hex digits "AB" must follow the "="
in the same encoded-word.)
Each encoded-word MUST represent an integral number of characters.
multi-octet character may not be split across adjacent encoded-words
Only printable and white space character data should be encoded
this scheme. However, since these encoding schemes allow
encoding of arbitrary octet values, mail readers that implement
decoding should also ensure that display of the decoded data on
recipient's terminal will not cause unwanted side-effects
Use of these methods to encode non-textual data (e.g., pictures
sounds) is not defined by this memo. Use of encoded-words
Moore [Page 6]
RFC 1522 MIME Part Two September 1993
represent strings of purely ASCII characters is allowed,
discouraged. In rare cases it may be necessary to encode
text that looks like an encoded-word
6. Support of encoded-words by mail
6.1. Recognition of encoded-words in message
A mail reader must parse the message and body part headers
to the rules in RFC 822 to correctly recognize encoded-words
Encoded-words are to be recognized as follows
(1) Any message or body part header field defined as "*text", or
user-defined header field, should be parsed as follows:
at the start of the field-body and immediately following
occurrence of linear-white-space, each sequence of up to 75
printable characters (not containing any linear-white-space
should be examined to see if it is an encoded-word according
the syntax rules in section 2. Any other sequence of
characters should be treated as ordinary ASCII text
(2) Any header field not defined as "*text" should be
according to the syntax rules for that header field. However
any "word" that appears within a "phrase" should be treated as
encoded-word if it meets the syntax rules in section 2.
Otherwise it should be treated as an ordinary "word".
(3) Within a "comment", any sequence of up to 75 printable
(not containing linear-white-space), that meets the syntax
in section 2, should be treated as an encoded-word. Otherwise
should be treated as normal comment text
6.2. Display of encoded-
Any encoded-words so recognized are decoded, and if possible,
resulting unencoded text is displayed in the original character set
When displaying a particular header field that contains
encoded-words, any linear-white-space that separates a pair
adjacent encoded-words is ignored. (This is to allow the use
multiple encoded-words to represent long strings of unencoded text
without having to separate encoded-words where spaces occur in
unencoded text.)
In the event other encodings are defined in the future, and the
reader does not support the encoding used, it may either (a)
the encoded-word as ordinary text, or (b) substitute an
Moore [Page 7]
RFC 1522 MIME Part Two September 1993
message indicating that the text could not be decoded
If the mail reader does not support the character set used, it
(a) display the encoded-word as ordinary text (i.e., as it appears
the header), (b) make a "best effort" to display using
characters as are available, or (c) substitute an appropriate
indicating that the decoded text could not be displayed
If the character set being used employs code-switching techniques
display of the encoded text implicitly begins in "ASCII mode".
addition, the mail reader must ensure that the output device is
again in "ASCII mode" after the encoded-word is displayed
6.3. Mail reader handling of incorrectly formed encoded-
It is possible that an encoded-word that is legal according to
syntax defined in section 2, is incorrectly formed according to
rules for the encoding being used. For example
(1) An encoded-word which contains characters which are not legal
a particular encoding (for example, a '-' in the "B" encoding),
is incorrectly formed
(2) Any encoded-word which encodes a non-integral number
characters or octets is incorrectly formed
A mail reader need not attempt to display the text associated with
encoded-word that is incorrectly formed. However, a mail reader
NOT prevent the display or handling of a message because an encoded
word is incorrectly formed
7.
A mail composing program claiming compliance with this
MUST ensure that any string of non-white-space printable
characters within a "*text" or "*ctext" that begins with "=?"
ends with "?=" be a valid encoded-word. ("begins" means: at
start of the field-body or immediately following linear-white-space
"ends" means: at the end of the field-body or immediately
linear-white-space.) In addition, any "word" within a "phrase"
begins with "=?" and ends with "?=" must be a valid encoded-word
A mail reading program claiming compliance with this
must be able to distinguish encoded-words from "text", "ctext",
"word"s, according to the rules in section 6, anytime they appear
appropriate places in message headers. It must support both the "B
and "Q" encodings for any character set which it supports.
program must be able to display the unencoded text if the
Moore [Page 8]
RFC 1522 MIME Part Two September 1993
set is "US-ASCII". For the ISO-8859-* character sets, the
reading program must at least be able to display the characters
are also in the ASCII set
8.
From: =?US-ASCII?Q?Keith_Moore?=
To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?=
CC: =?ISO-8859-1?Q?Andr=E9_?= Pirard
Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
From: =?ISO-8859-1?Q?Olle_J=E4rnefors?=
To: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.
Subject: Time for ISO 10646?
To: Dave Crocker stanford.edu
Cc: ietf-822@dimacs.rutgers.edu, paf@comsol.
From: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=
Subject: Re: RFC-HDR care and
From: Nathaniel Borenstein
(=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)
To: Greg Vaudreuil , Ned
, Keith Moore
Subject: Test of new header
MIME-Version: 1.0
Content-type: text/plain; charset=ISO-8859-1
9.
[1] Borenstein N., and N. Freed, "MIME (Multipurpose Internet
Extensions) Part One: Mechanisms for Specifying and
the Format of Internet Message Bodies", RFC 1521, Bellcore
Innosoft, September 1993.
[2] Crocker, D., "Standard for the Format of ARPA Internet
Messages", STD 11, RFC 822, UDEL, August 1982.
[3] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2,
RFC 1340, USC/Information Sciences Institute, July 1992.
Moore [Page 9]
RFC 1522 MIME Part Two September 1993
10. Security
Security issues are not discussed in this memo
11. Author's
Keith
University of
107 Ayres
Knoxville TN 37996-1301
EMail: moore@cs.utk.
Moore [Page 10]
if you see any problems within the linking, don't worry be happy,
this is version 0.1 of the Relevance System and you gotta expect some crappy subroutines sometimes,
just be content we did not write this in Java, which would have made this "bigger and better" HAHAHHA.
RFC documents can be found at I.E.T.F.
Relevance System Copyright © 2002 Spectrum WorldResearch
other technical nosh by ServerMasters Corporation
collaboration of BobX