/
290.txt
289 lines (228 loc) · 14.1 KB
/
290.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
[2] [[MIME]] の [DFN[[CODE(MIME)[multipart/alternative]] [[媒体型]]]]は、
同じ情報の複数の[Q[代替]]となる[[表現]]を1つにまとめるために使うことができる書式です。
[3] 例えば、[[電子メイル]]の[[宛先]]が正しくないことを伝える [[DSN]]
の[[メッセージ]]で、人間向けの説明文の[[日本語]]版と[[英語]]版を同時に含めることができます。
あるいは[[アニメーション]]画像を提供する時に、
[[MNG]] 版と [[GIF]] 版を提供し、受け取った側で使える方を使ってもらうということができます。
[4]
本質的には同じものを表す複数の[[表現]]を提供する技術としては [[HTTP]]
の[[内容折衝]]が有名ですが、 [[HTTP]] は提供側 ([[鯖]])
と利用側 ([[利用者エージェント]]) が直接通信するので、
[[利用者エージェント]]が用意した情報を使って[[鯖]]側で折衝
([[表現]]の選択) を行います。それに対して[[送信者]]と[[受信者]]が時間的・空間的に離れている[[電子メイル]]では、
[[送信者]]が用意した選択肢を
[CODE(MIME)[[[multipart/alternative]]]] 形式に詰め込み、
[[受信者]]がその中から好きなものを選ぶという方法を採っています。
* 仕様書
[REFS[
- [5] '''[CITE@en[RFC 2046 - Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types]] ([TIME[2015-03-22 13:14:46 +09:00]] 版) <http://tools.ietf.org/html/rfc2046#section-5.1.4>'''
- [26] [CITE@en[RFC 2046 - Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types]] ([TIME[2015-03-22 13:14:46 +09:00]] 版) <http://tools.ietf.org/html/rfc2046#section-5.2.3.7>
]REFS]
* 意味
[11] 各[[本体部分]]が同じ情報の異なる版であることを表します [SRC[>>5]]。
[20] [[本体部分]]の順序は、元の内容を忠実に表していないものから順に、
最後を最も好ましいものとしなければなりません。 [SRC[>>5]]
;; [23] 非 [[MIME]] [[利用者エージェント]]で表示する時はこの順序が好ましかろう
[SRC[>>5]] という配慮のようです。
* 構文
[6] [CODE(MIME)[multipart/alternative]] の構文は、
他の [CODE(MIME)[[[multipart/[VAR[*]]]]]] [[媒体型]]と共通です [SRC[>>5]]。
[[本体]]の部分に複数の[[本体部分]]を [CODE(MIME)[[[boundary]]]]
[[引数]]で区切って並べます。
[8] 含まれる各[[本体部分]]の順序は、
後の方程[Q[オリジナル]]に近いものにします。例えば元々の [[PDF]]
版、それから作成した [[HTML]] 版、[RUBY[[[平文]]] @en[プレイン・テキスト]]版と
3つあれば、[[平文]]、 [[HTML]]、 [[PDF]] の順で並べます。
このような順序にするのは、 [[MIME]] に対応していない[[利用者エージェント]]で見た時に
(つまり[[平文]]として見た時に) できるだけ[Q[ごみ]]が[[利用者]]に見えないようにと配慮されたことによります。
* 引数
[7]
,引数名 ,引数値 ,既定値 ,説明 ,状態 ,出典
,[CODE(MIME)[[[boundary]]]] , ,(必須) ,境界文字列 ,[[IETF]] [[原案標準]] ,[[MIME]]
,[CODE(MIME)[[[differences]]]] , , ,違う点 ,廃止 ([[IETF]] [[提案標準]]) ,[[RFC 1766]]
** "difference" パラメーター
RFC 1766 が定義していました。 multipart/alternative
で選択肢になっている各部分の差異について指定します。
RFC 1766 では値として、 one or more 個の "Content-Type" / "Content-Language"
/ iana-token が指定できるとされています。値は RFC
として出版されている頭領域名でなければなりません。
従って、値の大文字・小文字は区別しないのでしょう(明記されては
いません)。
「more」個の値を指定する例が示されていないので、どうするのか
わかりませんが、読点 (comma) 区切りと解するのが適当でしょうか。
RFC 1766 を廃止する RFC 3282 では、 differences
パラメーターは実際には使われなかったとして、
differences パラメーターも廃止しています。
値は IANA に登録することになってますが、それっぽい登録簿は
無いみたいです。
* 処理
[19] 実装は、各[[本体部分]]の内容が交換可能なものと認識するべきです。
環境に応じて、場合によっては[[利用者]]の指示により、
「最適」なものを選ぶべきです。 [SRC[>>5]]
[21] 一般に受信者の環境が対応する最後の[[本体部分]]が最善の選択です [SRC[>>5]]。
[22] 選択肢のいずれかが [CODE(MIME)@en[[[multipart/*]]]] の場合で、
認識でいない[[本体部分]]が含まれている場合は、
それを表示することにしても構いませんし、より前の[[本体部分]]を表示しても構いませんし、
両方でも構いません。 [SRC[>>5]]
[24] [[利用者]]に選択肢を提示しても構いません [SRC[>>5]]。
[25] いずれにせよ、[[利用者]]に同じデータの複数の版を同時に提示しないことが重要です [SRC[>>5]]。
* 用法
[28] [[HTMLメール]]では、 [CODE(MIME)@en[[[text/plain]]]] と
[CODE(MIME)@en[[[text/html]]]] の[[本体部分]]が含まれるのが基本です。
[29] [[HTMLメール]]の [[HTML]] 版に[[画像]]が埋め込まれている場合、
[CODE(MIME)@en[[[text/plain]]]] と [CODE(MIME)@en[[[multipart/related]]]]
で、 [CODE(MIME)@en[[[multipart/related]]]] 内に [CODE(MIME)@en[[[text/html]]]]
と[[画像]]が含まれることがあります。
[30] [[HTMLメール]]に[[添付ファイル]]が含まれる場合、 [CODE(MIME)@en[[[multipart/mixed]]]]
に [CODE(MIME)@en[[[multipart/alternative]]]] と[[添付ファイル]]が[[本体部分]]として含まれるのが一般的です。
;; [31] [CODE(MIME)@en[[[multipart/alternative]]]] を使わない [CODE(MIME)@en[[[text/html]]]]
だけの[[HTMLメール]]もあります。
* 歴史
[REFS[
= [DEL[[[RFC 1341]] ([[MIME]] 1[SUP[st]]) ([[IETF]] [[提案標準]]) <urn:ietf:rfc:1341>]]
= [DEL[[[RFC 1521]] ([[MIME]] 2[SUP[nd]]) ([[IETF]] [[原案標準]]) <urn:ietf:rfc:1521>]]
= [DEL[[[RFC 1766]] ([CODE(MIME)[differences]] 引数) ([[IETF]] [[提案標準]]) <urn:ietf:rfc:1766>]] ([[RFC 3282]] により[[廃止]])
= [[RFC 2046]] ([[MIME]] 3[SUP[rd]]) ([[IETF]] [[原案標準]]) <urn:ietf:rfc:2046>
-- [CSECTION@en[5.1.4. Alternative Subtype]]
]REFS]
[FIG(quote)[
[FIGCAPTION[
[10] RFC 2046 (MIME 3[SUP[rd]]) 5.1.4. Alternative Subtype
]FIGCAPTION]
> The "multipart/alternative" type is syntactically identical to
"multipart/mixed", but the semantics are different. In particular,
each of the body parts is an "alternative" version of the same
information.
[DFN[[CODE(MIME)[multipart/alternative]]]] 型は構文的には
[CODE(MIME)[[[multipart/mixed]]]] と同じですが、
意味的には異なります。特に、
各[[本体部分]]は同じ情報の[Q[代替]]版とします。
> Systems should recognize that the content of the various parts are
interchangeable. Systems should choose the "best" type based on the
local environment and references, in some cases even through user
interaction. As with "multipart/mixed", the order of body parts is
significant. In this case, the alternatives appear in an order of
increasing faithfulness to the original content. In general, the
best choice is the LAST part of a type supported by the recipient
system's local environment.
システムは各[[部分]]の[[内容]]は交換可能であることを認識するべきです。
システムは局所環境や場合によっては[[利用者]]との[[対話]]にも基づき、
[Q[最善]]な型を選ぶべきです。 [CODE(MIME)[[[multipart/mixed]]]]
と同じように[[本体部分]]の順序は意味を持ちます。この場合、
各選択肢は元の内容への忠実度の順に並べます。
通常、受信システムの局所環境で対応している型の'''最後'''の[[部分]]を選ぶのが最良です。
> "Multipart/alternative" may be used, for example, to send a message
in a fancy text format in such a way that it can easily be displayed anywhere:
[CODE(MIME)[multipart/alternative]] は例えば装飾付きの文章書式で[[メッセージ]]を送る時にどこでも簡単に表示できるようにするために使うことができます。
>
[PRE(822 example code)[
From: Nathaniel Borenstein <nsb@bellcore.com>
To: Ned Freed <ned@innosoft.com>
Date: Mon, 22 Mar 1993 09:41:09 -0800 (PST)
Subject: Formatted text mail
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=boundary42
--boundary42
Content-Type: text/plain; charset=us-ascii
... plain text version of message goes here ...
--boundary42
Content-Type: text/enriched
... RFC 1896 text/enriched version of same message
goes here ...
--boundary42
Content-Type: application/x-whatever
... fanciest version of same message goes here ...
--boundary42--
]PRE]
[PRE[
In this example, users whose mail systems understood the
"application/x-whatever" format would see only the fancy version,
while other users would see only the enriched or plain text version,
depending on the capabilities of their system.
]PRE]
[PRE[
In general, user agents that compose "multipart/alternative" entities
must place the body parts in increasing order of preference, that is,
with the preferred format last. For fancy text, the sending user
agent should put the plainest format first and the richest format
last. Receiving user agents should pick and display the last format
they are capable of displaying. In the case where one of the
alternatives is itself of type "multipart" and contains unrecognized
sub-parts, the user agent may choose either to show that alternative,
an earlier alternative, or both.
]PRE]
[PRE[
NOTE: From an implementor's perspective, it might seem more sensible
to reverse this ordering, and have the plainest alternative last.
However, placing the plainest alternative first is the friendliest
possible option when "multipart/alternative" entities are viewed
using a non-MIME-conformant viewer. While this approach does impose
some burden on conformant MIME viewers, interoperability with older
mail readers was deemed to be more important in this case.
]PRE]
[PRE[
It may be the case that some user agents, if they can recognize more
than one of the formats, will prefer to offer the user the choice of
which format to view. This makes sense, for example, if a message
includes both a nicely- formatted image version and an easily-edited
text version. What is most critical, however, is that the user not
automatically be shown multiple versions of the same data. Either
the user should be shown the last recognized version or should be
given the choice.
]PRE]
[PRE[
THE SEMANTICS OF CONTENT-ID IN MULTIPART/ALTERNATIVE: Each part of a
"multipart/alternative" entity represents the same data, but the
mappings between the two are not necessarily without information
loss. For example, information is lost when translating ODA to
PostScript or plain text. It is recommended that each part should
have a different Content-ID value in the case where the information
content of the two parts is not identical. And when the information
content is identical -- for example, where several parts of type
"message/external-body" specify alternate ways to access the
identical data -- the same Content-ID field value should be used, to
optimize any caching mechanisms that might be present on the
recipient's end. However, the Content-ID values used by the parts
should NOT be the same Content-ID value that describes the
"multipart/alternative" as a whole, if there is any such Content-ID
field. That is, one Content-ID value will refer to the
"multipart/alternative" entity, while one or more other Content-ID
values will refer to the parts inside it.
]PRE]
]FIG]
** RFC 1766
[REFS[
- [14] [CITE@en[RFC 1766 - Tags for the Identification of Languages]]
<http://tools.ietf.org/html/rfc1766#section-4>
]REFS]
* 関連
[9] [CODE(MIME)[[[Content-ID]]:]]
欄は[[実体]]の[[一意]]な識別子を与えるもので、
通常は[[実体]]ごとに異なるものとしなければなりませんが、
[CODE(MIME)[[[multipart/alternative]]]] 内の各[[本体部分]]の
[CODE(MIME)[Content-ID]] は同じものでも構わないとされています。
;; [CODE(MIME)@en[[[Content-ID:]]]] を参照。
[27] [CODE(MIME)@en[[[message/external-body]]]] と併用することで、
代替版をすべて含めて送らずとも、必要なものを[[受信者]]に取得させることができます [SRC[>>26]]。
* メモ
[1]
引数 [CODE(MIME)[[[differences]]]]
と似たようなのが [CODE(HTTP)[[[URI:]]]] 欄にもあったっけ。
[12] [CITE@en[RFC 5621 - Message Body Handling in the Session Initiation Protocol (SIP)]]
([TIME[2009-09-12 07:37:40 +09:00]] 版)
<http://tools.ietf.org/html/rfc5621#section-4>
[13] [CITE@en[RFC 5621 - Message Body Handling in the Session Initiation Protocol (SIP)]]
([TIME[2009-09-12 07:37:40 +09:00]] 版)
<http://tools.ietf.org/html/rfc5621#section-6>
[15] [CITE@en[RFC 5621 - Message Body Handling in the Session Initiation Protocol (SIP)]]
( ([TIME[2014-09-14 07:55:49 +09:00]] 版))
<http://tools.ietf.org/html/rfc5621#section-4.1>
[16] [CITE@en[RFC 5621 - Message Body Handling in the Session Initiation Protocol (SIP)]]
( ([TIME[2014-09-14 07:55:49 +09:00]] 版))
<http://tools.ietf.org/html/rfc5621#section-8.2>
[17] [CITE@en[RFC 3459 - Critical Content Multi-purpose Internet Mail Extensions (MIME) Parameter]]
( ([TIME[2014-09-28 14:54:36 +09:00]] 版))
<http://tools.ietf.org/html/rfc3459#section-12.1>
[18] [CITE@en[draft-jennings-sipping-multipart-02 - Session Initiation Protocol (SIP) Offer/Answer with Multipart Alternative]]
( ([TIME[2014-10-17 16:44:51 +09:00]] 版))
<https://tools.ietf.org/html/draft-jennings-sipping-multipart-02>