Debian Codegraph @

rfc2376.html

raw
1 <pre>Network Working Group E. Whitehead
2 Request for Comments: 2376 UC Irvine
3 Category: Informational M. Murata
4 Fuji Xerox Info. Systems
5 July 1998
6
7
8 <span class="h1">XML Media Types</span>
9
10 Status of this Memo
11
12 This memo provides information for the Internet community. It does
13 not specify an Internet standard of any kind. Distribution of this
14 memo is unlimited.
15
16 Copyright Notice
17
18 Copyright (C) The Internet Society (1998). All Rights Reserved.
19
20 Abstract
21
22 This document proposes two new media subtypes, text/xml and
23 application/xml, for use in exchanging network entities which are
24 conforming Extensible Markup Language (XML). XML entities are
25 currently exchanged via the HyperText Transfer Protocol on the World
26 Wide Web, are an integral part of the WebDAV protocol for remote web
27 authoring, and are expected to have utility in many domains.
28
29 Table of Contents
30
31 <a href="#section-1">1</a> INTRODUCTION ....................................................<a href="#page-2">2</a>
32 <a href="#section-2">2</a> NOTATIONAL CONVENTIONS ..........................................<a href="#page-3">3</a>
33 <a href="#section-3">3</a> XML MEDIA TYPES .................................................<a href="#page-3">3</a>
34 <a href="#section-3.1">3.1</a> Text/xml Registration ........................................<a href="#page-3">3</a>
35 <a href="#section-3.2">3.2</a> Application/xml Registration .................................<a href="#page-6">6</a>
36 <a href="#section-4">4</a> SECURITY CONSIDERATIONS .........................................<a href="#page-8">8</a>
37 <a href="#section-5">5</a> THE BYTE ORDER MARK (BOM) AND CONVERSIONS TO/FROM UTF-16 ........<a href="#page-9">9</a>
38 <a href="#section-6">6</a> EXAMPLES ........................................................<a href="#page-9">9</a>
39 <a href="#section-6.1">6.1</a> text/xml with UTF-8 Charset .................................<a href="#page-10">10</a>
40 <a href="#section-6.2">6.2</a> text/xml with UTF-16 Charset ................................<a href="#page-10">10</a>
41 <a href="#section-6.3">6.3</a> text/xml with ISO-2022-KR Charset ...........................<a href="#page-10">10</a>
42 <a href="#section-6.4">6.4</a> text/xml with Omitted Charset ...............................<a href="#page-11">11</a>
43 <a href="#section-6.5">6.5</a> application/xml with UTF-16 Charset .........................<a href="#page-11">11</a>
44 <a href="#section-6.6">6.6</a> application/xml with ISO-2022-KR Charset ....................<a href="#page-11">11</a>
45 <a href="#section-6.7">6.7</a> application/xml with Omitted Charset and UTF-16 XML Entity ..12
46 <a href="#section-6.8">6.8</a> application/xml with Omitted Charset and UTF-8 Entity .......<a href="#page-12">12</a>
47 6.9 application/xml with Omitted Charset and Internal Encoding
48 Declaration.......................................................<a href="#page-12">12</a>
49
50
51
52 <span class="grey">Whitehead &amp; Murata Informational [Page 1]</span></pre>
53 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
54 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
55
56
57 <a href="#section-7">7</a> REFERENCES .....................................................<a href="#page-13">13</a>
58 <a href="#section-8">8</a> ACKNOWLEDGEMENTS ...............................................<a href="#page-14">14</a>
59 <a href="#section-9">9</a> ADDRESSES OF AUTHORS ...........................................<a href="#page-14">14</a>
60 <a href="#section-10">10</a> FULL COPYRIGHT STATEMENT ......................................<a href="#page-15">15</a>
61
62 <span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a> Introduction</span>
63
64 The World Wide Web Consortium (W3C) has issued a Recommendation
65 [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>] which defines the Extensible Markup Language (XML), version
66 1. To enable the exchange of XML network entities, this document
67 proposes two new media types, text/xml and application/xml.
68
69 XML entities are currently exchanged on the World Wide Web, and XML
70 is also used for property values and parameter marshalling by the
71 WebDAV protocol for remote web authoring. Thus, there is a need for a
72 media type to properly label the exchange of XML network entities.
73 (Note that, as sometimes happens between two communities, both MIME
74 and XML have defined the term entity, with different meanings.)
75
76 Although XML is a subset of the Standard Generalized Markup Language
77 (SGML) [<a href="#ref-ISO-8897">ISO-8897</a>], and currently is assigned the media types
78 text/sgml and application/sgml, there are several reasons why use of
79 text/sgml or application/sgml to label XML is inappropriate. First,
80 there exist many applications which can process XML, but which cannot
81 process SGML, due to SGML's larger feature set. Second, SGML
82 applications cannot always process XML entities, because XML uses
83 features of recent technical corrigenda to SGML. Third, the
84 definition of text/sgml and application/sgml [<a href="./rfc1874" title="&quot;SGML Media Types&quot;">RFC-1874</a>] includes
85 parameters for SGML bit combination transformation format (SGML-
86 bctf), and SGML boot attribute (SGML-boot). Since XML does not use
87 these parameters, it would be ambiguous if such parameters were given
88 for an XML entity. For these reasons, the best approach for labeling
89 XML network entities is to provide new media types for XML.
90
91 Since XML is an integral part of the WebDAV Distributed Authoring
92 Protocol, and since World Wide Web Consortium Recommendations have
93 conventionally been assigned IETF tree media types, and since similar
94 media types (HTML, SGML) have been assigned IETF tree media types,
95 the XML media types also belong in the IETF media types tree.
96
97
98
99
100
101
102
103
104
105
106
107
108 <span class="grey">Whitehead &amp; Murata Informational [Page 2]</span></pre>
109 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
110 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
111
112
113 <span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a> Notational Conventions</span>
114
115 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
116 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
117 document are to be interpreted as described in [<a href="./rfc2119" title="&quot;Key words for use in RFCs to Indicate Requirement Levels&quot;">RFC-2119</a>].
118
119 <span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a> XML Media Types</span>
120
121 This document introduces two new media types for XML entities,
122 text/xml and application/xml. Registration information for these
123 media types are described in the sections below.
124
125 Every XML entity is suitable for use with the application/xml media
126 type without modification. But this does not exploit the fact that
127 XML can be treated as plain text in many cases. MIME user agents
128 (and web user agents) that do not have explicit support for
129 application/xml will treat it as application/octet-stream, for
130 example, by offering to save it to a file.
131
132 To indicate that an XML entity should be treated as plain text by
133 default, use the text/xml media type. This restricts the encoding
134 used in the XML entity to those that are compatible with the
135 requirements for text media types as described in [<a href="./rfc2045" title="&quot;Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies&quot;">RFC-2045</a>] and
136 [<a href="./rfc2046" title="&quot;Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types&quot;">RFC-2046</a>], e.g., UTF-8, but not UTF-16 (except for HTTP).
137
138 XML provides a general framework for defining sequences of structured
139 data. In some cases, it may be desirable to define new media types
140 which use XML but define a specific application of XML, perhaps due
141 to domain-specific security considerations or runtime information.
142 This document does not prohibit future media types dedicated to such
143 XML applications. However, developers of such media types are
144 recommended to use this document as a basis. In particular, the
145 charset parameter should be used in the same manner.
146
147 Within the XML specification, XML entities can be classified into
148 four types. In the XML terminology, they are called "document
149 entities", "external DTD subsets", "external parsed entities", and
150 "external parameter entities". The media types text/xml and
151 application/xml can be used for any of these four types.
152
153 <span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a> Text/xml Registration</span>
154
155 MIME media type name: text
156
157 MIME subtype name: xml
158
159 Mandatory parameters: none
160
161
162
163
164 <span class="grey">Whitehead &amp; Murata Informational [Page 3]</span></pre>
165 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
166 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
167
168
169 Optional parameters: charset
170
171 Although listed as an optional parameter, the use of the charset
172 parameter is STRONGLY RECOMMENDED, since this information can be
173 used by XML processors to determine authoritatively the character
174 encoding of the XML entity. The charset parameter can also be used
175 to provide protocol-specific operations, such as charset-based
176 content negotiation in HTTP. "UTF-8" [<a href="./rfc2279" title="&quot;UTF-8, a transformation format of ISO 10646&quot;">RFC-2279</a>] is the
177 recommended value, representing the UTF-8 charset. UTF-8 is
178 supported by all conforming XML processors [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>].
179
180 If the XML entity is transmitted via HTTP, which uses a MIME-like
181 mechanism that is exempt from the restrictions on the text top-
182 level type (see <a href="#section-19.4.1">section 19.4.1</a> of HTTP 1.1 [<a href="./rfc2068" title="&quot;Hypertext Transfer Protocol -- HTTP/1.1&quot;">RFC-2068</a>]), "UTF-16"
183 (Appendix C.3 of [<a href="#ref-UNICODE" title="&quot;The Unicode Standard -- Version 2.0&quot;">UNICODE</a>] and Amendment 1 of [<a href="#ref-ISO-10646" title="Information Technology - Universal Multiple- Octet Coded Character Set (UCS) - Part 1: Architecture and Basic Multilingual Plane">ISO-10646</a>]) is also
184 recommended. UTF-16 is supported by all conforming XML processors
185 [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>]. Since the handling of CR, LF and NUL for text types in
186 most MIME applications would cause undesired transformations of
187 individual octets in UTF-16 multi-octet characters, gateways from
188 HTTP to these MIME applications MUST transform the XML entity from
189 a text/xml; charset="utf-16" to application/xml; charset="utf-16".
190
191 Conformant with [<a href="./rfc2046" title="&quot;Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types&quot;">RFC-2046</a>], if a text/xml entity is received with
192 the charset parameter omitted, MIME processors and XML processors
193 MUST use the default charset value of "us-ascii". In cases where
194 the XML entity is transmitted via HTTP, the default charset value
195 is still "us-ascii".
196
197 Since the charset parameter is authoritative, the charset is not
198 always declared within an XML encoding declaration. Thus, special
199 care is needed when the recipient strips the MIME header and
200 provides persistent storage of the received XML entity (e.g., in a
201 file system). Unless the charset is UTF-8 or UTF-16, the recipient
202 SHOULD also persistently store information about the charset,
203 perhaps by embedding a correct XML encoding declaration within the
204 XML entity.
205
206 Encoding considerations:
207
208 This media type MAY be encoded as appropriate for the charset and
209 the capabilities of the underlying MIME transport. For 7-bit
210 transports, data in both UTF-8 and UTF-16 is encoded in quoted-
211 printable or base64. For 8-bit clean transport (e.g., ESMTP,
212 8BITMIME, or NNTP), UTF-8 is not encoded, but UTF-16 is base64
213 encoded. For binary clean transports (e.g., HTTP), no content-
214 transfer-encoding is necessary.
215
216
217
218
219
220 <span class="grey">Whitehead &amp; Murata Informational [Page 4]</span></pre>
221 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
222 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
223
224
225 Security considerations:
226
227 See <a href="#section-4">section 4</a> below.
228
229 Interoperability considerations:
230
231 XML has proven to be interoperable across WebDAV clients and
232 servers, and for import and export from multiple XML authoring
233 tools.
234
235 Published specification: see [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>]
236
237 Applications which use this media type:
238
239 XML is device-, platform-, and vendor-neutral and is supported by
240 a wide range of Web user agents, WebDAV clients and servers, as
241 well as XML authoring tools.
242
243 Additional information:
244
245 Magic number(s): none
246
247 Although no byte sequences can be counted on to always be present,
248 XML entities in ASCII-compatible charsets (including UTF-8) often
249 begin with hexadecimal 3C 3F 78 6D 6C ("&lt;?xml"). For more
250 information, see <a href="#appendix-F">Appendix F</a> of [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>].
251
252 File extension(s): .xml, .dtd
253 Macintosh File Type Code(s): "TEXT"
254
255 Person &amp; email address for further information:
256
257 Dan Connolly &lt;[email protected]&gt;
258 Murata Makoto (Family Given) &lt;[email protected]&gt;
259
260 Intended usage: COMMON
261
262 Author/Change controller:
263
264 The XML specification is a work product of the World Wide Web
265 Consortium's XML Working Group, and was edited by:
266
267 Tim Bray &lt;[email protected]&gt;
268 Jean Paoli &lt;[email protected]&gt;
269 C. M. Sperberg-McQueen &lt;[email protected]&gt;
270
271 The W3C, and the W3C XML working group, has change control over
272 the XML specification.
273
274
275
276 <span class="grey">Whitehead &amp; Murata Informational [Page 5]</span></pre>
277 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
278 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
279
280
281 <span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a> Application/xml Registration</span>
282
283 MIME media type name: application
284
285 MIME subtype name: xml
286
287 Mandatory parameters: none
288
289 Optional parameters: charset
290
291 Although listed as an optional parameter, the use of the charset
292 parameter is STRONGLY RECOMMENDED, since this information can be
293 used by XML processors to determine authoritatively the charset of
294 the XML entity. The charset parameter can also be used to provide
295 protocol-specific operations, such as charset-based content
296 negotiation in HTTP.
297
298 "UTF-8" [<a href="./rfc2279" title="&quot;UTF-8, a transformation format of ISO 10646&quot;">RFC-2279</a>] and "UTF-16" (Appendix C.3 of [<a href="#ref-UNICODE" title="&quot;The Unicode Standard -- Version 2.0&quot;">UNICODE</a>] and
299 Amendment 1 of [<a href="#ref-ISO-10646" title="Information Technology - Universal Multiple- Octet Coded Character Set (UCS) - Part 1: Architecture and Basic Multilingual Plane">ISO-10646</a>]) are the recommended values,
300 representing the UTF-8 and UTF-16 charsets, respectively. These
301 charsets are preferred since they are supported by all conforming
302 XML processors [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>].
303
304 If an application/xml entity is received where the charset
305 parameter is omitted, no information is being provided about the
306 charset by the MIME Content-Type header. Conforming XML processors
307 MUST follow the requirements in section 4.3.3 of [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>] which
308 directly address this contingency. However, MIME processors which
309 are not XML processors should not assume a default charset if the
310 charset parameter is omitted from an application/xml entity.
311
312 Since the charset parameter is authoritative, the charset is not
313 always declared within an XML encoding declaration. Thus, special
314 care is needed when the recipient strips the MIME header and
315 provides persistent storage of the received XML entity (e.g., in a
316 file system). Unless the charset is UTF-8 or UTF-16, the
317 recipient SHOULD also persistently store information about the
318 charset, perhaps by embedding a correct XML encoding declaration
319 within the XML entity.
320
321
322
323
324
325
326
327
328
329
330
331
332 <span class="grey">Whitehead &amp; Murata Informational [Page 6]</span></pre>
333 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
334 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
335
336
337 Encoding considerations:
338
339 This media type MAY be encoded as appropriate for the charset and
340 the capabilities of the underlying MIME transport. For 7-bit
341 transports, data in both UTF-8 and UTF-16 is encoded in quoted-
342 printable or base64. For 8-bit clean transport (e.g., ESMTP,
343 8BITMIME, or NNTP), UTF-8 is not encoded, but UTF-16 is base64
344 encoded. For binary clean transport (e.g., HTTP), no content-
345 transfer-encoding is necessary.
346
347 Security considerations:
348
349 See <a href="#section-4">section 4</a> below.
350
351 Interoperability considerations:
352
353 XML has proven to be interoperable for import and export from
354 multiple XML authoring tools.
355
356 Published specification: see [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>]
357
358 Applications which use this media type:
359
360 XML is device-, platform-, and vendor-neutral and is supported by
361 a wide range of Web user agents and XML authoring tools.
362
363 Additional information:
364
365 Magic number(s): none
366
367 Although no byte sequences can be counted on to always be present,
368 XML entities in ASCII-compatible charsets (including UTF-8) often
369 begin with hexadecimal 3C 3F 78 6D 6C ("&lt;?xml"), and those in
370 UTF-16 often begin with hexadecimal FE FF 00 3C 00 3F 00 78 00 6D
371 or FF FE 3C 00 3F 00 78 00 6D 00 (the Byte Order Mark (BOM)
372 followed by "&lt;?xml"). For more information, see Annex F of [REC-
373 XML].
374
375 File extension(s): .xml, .dtd
376 Macintosh File Type Code(s): "TEXT"
377
378 Person &amp; email address for further information:
379
380 Dan Connolly &lt;[email protected]&gt;
381 Murata Makoto (Family Given) &lt;[email protected]&gt;
382
383 Intended usage: COMMON
384
385
386
387
388 <span class="grey">Whitehead &amp; Murata Informational [Page 7]</span></pre>
389 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
390 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
391
392
393 Author/Change controller:
394
395 The XML specification is a work product of the World Wide Web
396 Consortium's XML Working Group, and was edited by:
397
398 Tim Bray &lt;[email protected]&gt;
399 Jean Paoli &lt;[email protected]&gt;
400 C. M. Sperberg-McQueen &lt;[email protected]&gt;
401
402 The W3C, and the W3C XML working group, has change control over
403 the XML specification.
404
405 <span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a> Security Considerations</span>
406
407 XML, as a subset of SGML, has the same security considerations as
408 specified in [<a href="./rfc1874" title="&quot;SGML Media Types&quot;">RFC-1874</a>].
409
410 To paraphrase <a href="./rfc1874#section-3">section&nbsp;3 of [RFC-1874]</a>, XML entities contain
411 information to be parsed and processed by the recipient's XML system.
412 These entities may contain and such systems may permit explicit
413 system level commands to be executed while processing the data. To
414 the extent that an XML system will execute arbitrary command strings,
415 recipients of XML entities may be at risk. In general, it may be
416 possible to specify commands that perform unauthorized file
417 operations or make changes to the display processor's environment
418 that affect subsequent operations.
419
420 Use of XML is expected to be varied, and widespread. XML is under
421 scrutiny by a wide range of communities for use as a common syntax
422 for community-specific metadata. For example, the Dublin Core group
423 is using XML for document metadata, and a new effort has begun which
424 is considering use of XML for medical information. Other groups view
425 XML as a mechanism for marshalling parameters for remote procedure
426 calls. More uses of XML will undoubtedly arise.
427
428 Security considerations will vary by domain of use. For example, XML
429 medical records will have much more stringent privacy and security
430 considerations than XML library metadata. Similarly, use of XML as a
431 parameter marshalling syntax necessitates a case by case security
432 review.
433
434 XML may also have some of the same security concerns as plain text.
435 Like plain text, XML can contain escape sequences which, when
436 displayed, have the potential to change the display processor
437 environment in ways that adversely affect subsequent operations.
438 Possible effects include, but are not limited to, locking the
439 keyboard, changing display parameters so subsequent displayed text is
440 unreadable, or even changing display parameters to deliberately
441
442
443
444 <span class="grey">Whitehead &amp; Murata Informational [Page 8]</span></pre>
445 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
446 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
447
448
449 obscure or distort subsequent displayed material so that its meaning
450 is lost or altered. Display processors should either filter such
451 material from displayed text or else make sure to reset all important
452 settings after a given display operation is complete.
453
454 Some terminal devices have keys whose output, when pressed, can be
455 changed by sending the display processor a character sequence. If
456 this is possible the display of a text object containing such
457 character sequences could reprogram keys to perform some illicit or
458 dangerous action when the key is subsequently pressed by the user.
459 In some cases not only can keys be programmed, they can be triggered
460 remotely, making it possible for a text display operation to directly
461 perform some unwanted action. As such, the ability to program keys
462 should be blocked either by filtering or by disabling the ability to
463 program keys entirely.
464
465 Note that it is also possible to construct XML documents which make
466 use of what XML terms "entity references" (using the XML meaning of
467 the term "entity", which differs from the MIME definition of this
468 term), to construct repeated expansions of text. Recursive expansions
469 are prohibited [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>] and XML processors are required to detect
470 them. However, even non-recursive expansions may cause problems with
471 the finite computing resources of computers, if they are performed
472 many times.
473
474 <span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a> The Byte Order Mark (BOM) and Conversions to/from UTF-16</span>
475
476 The XML Recommendation, in <a href="#section-4.3.3">section 4.3.3</a>, specifies that UTF-16 XML
477 entities must begin with a byte order mark (BOM), which is the ZERO
478 WIDTH NO-BREAK SPACE character, hexadecimal sequence 0xFEFF (or
479 0xFFFE, depending on endian). The XML Recommendation further states
480 that the BOM is an encoding signature, and is not part of either the
481 markup or the character data of the XML document.
482
483 Due to the BOM, applications which convert XML from the UTF-16
484 encoding to another encoding SHOULD strip the BOM before conversion.
485 Similarly, when converting from another encoding into UTF-16, the BOM
486 SHOULD be added after conversion is complete.
487
488 <span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a> Examples</span>
489
490 The examples below give the value of the Content-type MIME header and
491 the XML declaration (which includes the encoding declaration) inside
492 the XML entity. For UTF-16 examples, the Byte Order Mark character
493 is denoted as "{BOM}", and the XML declaration is assumed to come at
494 the beginning of the XML entity, immediately following the BOM. Note
495 that other MIME headers may be present, and the XML entity may
496
497
498
499
500 <span class="grey">Whitehead &amp; Murata Informational [Page 9]</span></pre>
501 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
502 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
503
504
505 contain other data in addition to the XML declaration; the examples
506 focus on the Content-type header and the encoding declaration for
507 clarity.
508
509 <span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a> text/xml with UTF-8 Charset</span>
510
511 Content-type: text/xml; charset="utf-8"
512
513 &lt;?xml version="1.0" encoding="utf-8"?&gt;
514
515 This is the recommended charset value for use with text/xml. Since
516 the charset parameter is provided, MIME and XML processors must treat
517 the enclosed entity as UTF-8 encoded.
518
519 If sent using a 7-bit transport (e.g. SMTP), the XML entity must use
520 a content-transfer-encoding of either quoted-printable or base64.
521 For an 8-bit clean transport (e.g., ESMTP, 8BITMIME, or NNTP), or a
522 binary clean transport (e.g., HTTP) no content-transfer-encoding is
523 necessary.
524
525 <span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a> text/xml with UTF-16 Charset</span>
526
527 Content-type: text/xml; charset="utf-16"
528
529 {BOM}&lt;?xml version='1.0' encoding='utf-16'?&gt;
530
531 This is possible only when the XML entity is transmitted via HTTP,
532 which uses a MIME-like mechanism and is a binary-clean protocol,
533 hence does not perform CR and LF transformations and allows NUL
534 octets. This differs from typical text MIME type processing (see
535 <a href="#section-19.4.1">section 19.4.1</a> of HTTP 1.1 [<a href="./rfc2068" title="&quot;Hypertext Transfer Protocol -- HTTP/1.1&quot;">RFC-2068</a>] for details).
536
537 Since HTTP is binary clean, no content-transfer-encoding is
538 necessary.
539
540 <span class="h3"><a class="selflink" id="section-6.3" href="#section-6.3">6.3</a> text/xml with ISO-2022-KR Charset</span>
541
542 Content-type: text/xml; charset="iso-2022-kr"
543
544 &lt;?xml version="1.0" encoding='iso-2022-kr'?&gt;
545
546 This example shows text/xml with a Korean charset (e.g., Hangul)
547 encoded following the specification in [<a href="./rfc1557" title="&quot;Korean Character Encoding for Internet Messages&quot;">RFC-1557</a>]. Since the charset
548 parameter is provided, MIME and XML processors must treat the
549 enclosed entity as encoded per [<a href="./rfc1557" title="&quot;Korean Character Encoding for Internet Messages&quot;">RFC-1557</a>].
550
551 Since ISO-2022-KR has been defined to use only 7 bits of data, no
552 content-transfer-encoding is necessary with any transport.
553
554
555
556 <span class="grey">Whitehead &amp; Murata Informational [Page 10]</span></pre>
557 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
558 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
559
560
561 <span class="h3"><a class="selflink" id="section-6.4" href="#section-6.4">6.4</a> text/xml with Omitted Charset</span>
562
563 Content-type: text/xml
564
565 {BOM}&lt;?xml version="1.0" encoding="utf-16"?&gt;
566
567 This example shows text/xml with the charset parameter omitted. In
568 this case, MIME and XML processors must assume the charset is "us-
569 ascii", the default charset value for text media types specified in
570 [<a href="./rfc2046" title="&quot;Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types&quot;">RFC-2046</a>]. The default of "us-ascii" holds even if the text/xml
571 entity is transported using HTTP.
572
573 Omitting the charset parameter is NOT RECOMMENDED for text/xml. For
574 example, even if the contents of the XML entity are UTF-16 or UTF-8,
575 or the XML entity has an explicit encoding declaration, XML and MIME
576 processors must assume the charset is "us-ascii".
577
578 <span class="h3"><a class="selflink" id="section-6.5" href="#section-6.5">6.5</a> application/xml with UTF-16 Charset</span>
579
580 Content-type: application/xml; charset="utf-16"
581
582 {BOM}&lt;?xml version="1.0"?&gt;
583
584 This is a recommended charset value for use with application/xml.
585 Since the charset parameter is provided, MIME and XML processors must
586 treat the enclosed entity as UTF-16 encoded.
587
588 If sent using a 7-bit transport (e.g., SMTP) or an 8-bit clean
589 transport (e.g., ESMTP, 8BITMIME, or NNTP), the XML entity must be
590 encoded in quoted-printable or base64. For a binary clean transport
591 (e.g., HTTP), no content-transfer-encoding is necessary.
592
593 <span class="h3"><a class="selflink" id="section-6.6" href="#section-6.6">6.6</a> application/xml with ISO-2022-KR Charset</span>
594
595 Content-type: application/xml; charset="iso-2022-kr"
596
597 &lt;?xml version="1.0" encoding="iso-2022-kr"?&gt;
598
599 This example shows application/xml with a Korean charset (e.g.,
600 Hangul) encoded following the specification in [<a href="./rfc1557" title="&quot;Korean Character Encoding for Internet Messages&quot;">RFC-1557</a>]. Since the
601 charset parameter is provided, MIME and XML processors must treat the
602 enclosed entity as encoded per [<a href="./rfc1557" title="&quot;Korean Character Encoding for Internet Messages&quot;">RFC-1557</a>], independent of whether the
603 XML entity has an internal encoding declaration (this example does
604 show such a declaration, which agrees with the charset parameter).
605
606 Since ISO-2022-KR has been defined to use only 7 bits of data, no
607 content-transfer-encoding is necessary with any transport.
608
609
610
611
612 <span class="grey">Whitehead &amp; Murata Informational [Page 11]</span></pre>
613 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
614 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
615
616
617 <span class="h3"><a class="selflink" id="section-6.7" href="#section-6.7">6.7</a> application/xml with Omitted Charset and UTF-16 XML Entity</span>
618
619 Content-type: application/xml
620
621 {BOM}&lt;?xml version='1.0'?&gt;
622
623 For this example, the XML entity begins with a BOM. Since the
624 charset has been omitted, a conforming XML processor follows the
625 requirements of [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>], section 4.3.3. Specifically, the XML
626 processor reads the BOM, and thus knows deterministically that the
627 charset encoding is UTF-16.
628
629 An XML-unaware MIME processor should make no assumptions about the
630 charset of the XML entity.
631
632 <span class="h3"><a class="selflink" id="section-6.8" href="#section-6.8">6.8</a> application/xml with Omitted Charset and UTF-8 Entity</span>
633
634 Content-type: application/xml
635
636 &lt;?xml version='1.0'?&gt;
637
638 In this example, the charset parameter has been omitted, and there is
639 no BOM. Since there is no BOM, the XML processor follows the
640 requirements in <a href="#section-4.3.3">section 4.3.3</a>, and optionally applies the mechanism
641 described in <a href="#appendix-F">appendix F</a> (which is non-normative) of [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>] to
642 determine the charset encoding of UTF-8. The XML entity does not
643 contain an encoding declaration, but since the encoding is UTF-8,
644 this is still a conforming XML entity.
645
646 An XML-unaware MIME processor should make no assumptions about the
647 charset of the XML entity.
648
649 <span class="h3"><a class="selflink" id="section-6.9" href="#section-6.9">6.9</a> application/xml with Omitted Charset and Internal Encoding</span>
650 <span class="h3"> Declaration</span>
651
652 Content-type: application/xml
653
654 &lt;?xml version='1.0' encoding="ISO-10646-UCS-4"?&gt;
655
656 In this example, the charset parameter has been omitted, and there is
657 no BOM. However, the XML entity does have an encoding declaration
658 inside the XML entity which specifies the entity's charset. Following
659 the requirements in <a href="#section-4.3.3">section 4.3.3</a>, and optionally applying the
660 mechanism described in <a href="#appendix-F">appendix F</a> (non-normative) of [<a href="#ref-REC-XML" title="&quot;Extensible Markup Language (XML)&quot;">REC-XML</a>], the
661 XML processor determines the charset encoding of the XML entity (in
662 this example, UCS-4).
663
664
665
666
667
668 <span class="grey">Whitehead &amp; Murata Informational [Page 12]</span></pre>
669 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
670 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
671
672
673 An XML-unaware MIME processor should make no assumptions about the
674 charset of the XML entity.
675
676 <span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a> References</span>
677
678 [<a id="ref-ISO-10646">ISO-10646</a>] ISO/IEC, Information Technology - Universal Multiple-
679 Octet Coded Character Set (UCS) - Part 1: Architecture
680 and Basic Multilingual Plane, May 1993.
681
682 [<a id="ref-ISO-8897">ISO-8897</a>] ISO (International Organization for Standardization) ISO
683 8879:1986(E) Information Processing -- Text and Office
684 Systems -- Standard Generalized Markup Language (SGML).
685 First edition -- 1986- 10-15.
686
687 [<a id="ref-REC-XML">REC-XML</a>] T. Bray, J. Paoli, C. M. Sperberg-McQueen, "Extensible
688 Markup Language (XML)" World Wide Web Consortium
689 Recommendation REC- xml-19980210.
690 <a href="http://www.w3.org/TR/1998/REC-xml-19980210">http://www.w3.org/TR/1998/REC-xml-19980210</a>.
691
692 [<a id="ref-RFC-1557">RFC-1557</a>] Choi, U., Chon, K., and H. Park. "Korean Character
693 Encoding for Internet Messages", <a href="./rfc1557">RFC 1557</a>. December,
694 1993.
695
696 [<a id="ref-RFC-1874">RFC-1874</a>] Levinson, E., "SGML Media Types", <a href="./rfc1874">RFC 1874</a>. December
697 1995.
698
699 [<a id="ref-RFC-2119">RFC-2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
700 Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
701
702 [<a id="ref-RFC-2045">RFC-2045</a>] Freed, N., and N. Borenstein, "Multipurpose Internet Mail
703 Extensions (MIME) Part One: Format of Internet Message
704 Bodies", <a href="./rfc2045">RFC 2045</a>, November 1996.
705
706 [<a id="ref-RFC-2046">RFC-2046</a>] Freed, N., and N. Borenstein, "Multipurpose Internet Mail
707 Extensions (MIME) Part Two: Media Types", <a href="./rfc2046">RFC 2046</a>,
708 November 1996.
709
710 [<a id="ref-RFC-2068">RFC-2068</a>] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., and T.
711 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1",
712 <a href="./rfc2068">RFC 2068</a>, January 1997.
713
714 [<a id="ref-RFC-2279">RFC-2279</a>] Yergeau, F., "UTF-8, a transformation format of ISO
715 10646", <a href="./rfc2279">RFC 2279</a>, January 1998.
716
717 [<a id="ref-UNICODE">UNICODE</a>] The Unicode Consortium, "The Unicode Standard -- Version
718 2.0", Addison-Wesley, 1996.
719
720
721
722
723
724 <span class="grey">Whitehead &amp; Murata Informational [Page 13]</span></pre>
725 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
726 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
727
728
729 <span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a> Acknowledgements</span>
730
731 Chris Newman and Yaron Y. Goland both contributed content to the
732 security considerations section of this document. In particular,
733 some text in the security considerations section is copied verbatim
734 from work in progress, <a href="./draft-newman-mime-textpara-00">draft-newman-mime-textpara-00</a>, by permission
735 of the author. Chris Newman additionally contributed content to the
736 encoding considerations sections. Dan Connolly contributed content
737 discussing when to use text/xml. Discussions with Ned Freed and Dan
738 Connolly helped refine the author's understanding of the text media
739 type; feedback from Larry Masinter was also very helpful in
740 understanding media type registration issues.
741
742 Members of the W3C XML Working Group and XML Special Interest group
743 have made significant contributions to this document, and the authors
744 would like to specially recognize James Clark, Martin Duerst, Rick
745 Jelliffe, Gavin Nicol for their many thoughtful comments.
746
747 <span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a> Addresses of Authors</span>
748
749 E. James Whitehead, Jr.
750 Dept. of Information and Computer Science
751 University of California, Irvine
752 Irvine, CA 92697-3425
753
754 EMail: [email protected]
755
756
757 Murata Makoto (Family Given)
758 Fuji Xerox Information Systems,
759 KSP 9A7, 2-1, Sakado 3-chome, Takatsu-ku,
760 Kawasaki-shi, Kanagawa-ken,
761 213 Japan
762
763 EMail: [email protected]
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780 <span class="grey">Whitehead &amp; Murata Informational [Page 14]</span></pre>
781 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
782 <span class="grey"><a href="./rfc2376">RFC 2376</a> XML Media Types July 1998</span>
783
784
785 <span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a> Full Copyright Statement</span>
786
787 Copyright (C) The Internet Society (1998). All Rights Reserved.
788
789 This document and translations of it may be copied and furnished to
790 others, and derivative works that comment on or otherwise explain it
791 or assist in its implementation may be prepared, copied, published
792 and distributed, in whole or in part, without restriction of any
793 kind, provided that the above copyright notice and this paragraph are
794 included on all such copies and derivative works. However, this
795 document itself may not be modified in any way, such as by removing
796 the copyright notice or references to the Internet Society or other
797 Internet organizations, except as needed for the purpose of
798 developing Internet standards in which case the procedures for
799 copyrights defined in the Internet Standards process must be
800 followed, or as required to translate it into languages other than
801 English.
802
803 The limited permissions granted above are perpetual and will not be
804 revoked by the Internet Society or its successors or assigns.
805
806 This document and the information contained herein is provided on an
807 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
808 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
809 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
810 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
811 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836 Whitehead &amp; Murata Informational [Page 15]
837 </pre>