RFC 6657

Update to MIME regarding "charset" Parameter Handling in Textual Media Types

πŸ“… published July 2012, from ietf

RFC 6657: Update to MIME regarding "charset" Parameter Handling in Textual Media Types πŸŽ€

Okay bestie, this is RFC 6657 πŸ’– It's an IETF Standards Track doc from July 2012, and the title block has all the tea:

  • Number: RFC 6657
  • Title: Update to MIME regarding "charset" Parameter Handling in Textual Media Types
  • Authors: Alexey Melnikov (Isode Limited) and Julian F. Reschke (greenbytes)
  • Category: Standards Track
  • Date: July 2012
  • Updates: RFC 2046
  • Obsoletes: none listed
  • ISSN: 2070-1721

It's a sequel-style fix to MIME, so let's go πŸ’…


Abstract ✨

This doc changes the RFC 2046 rules about the default charset parameter values for text/* media types. The goal is to line them up with what existing clients and servers actually do in the wild 🌸

Status of This Memo πŸ“œ

This is an Internet Standards Track document.

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6657.

Copyright (c) 2012 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

Table of Contents 🧚

1. Introduction and Overview .......................................2
2. Conventions Used in This Document ...............................2
3. New Rules for Default "charset" Parameter Values for
   "text/*" Media Types ............................................3
4. Default "charset" Parameter Value for "text/plain" Media Type ...4
5. Security Considerations .........................................4
6. IANA Considerations .............................................4
7. References ......................................................4
   7.1. Normative References .......................................4
   7.2. Informative References .....................................5
Appendix A.  Acknowledgements ......................................6

1. Introduction and Overview ✨

Okay so RFC 2046 said the default charset parameter (the value you get when the parameter isn't specified at all) is "US-ASCII" (Section 4.1.2 of [RFC2046]). Then RFC 2616 said HTTP should default to "ISO-8859-1" instead (Section 3.7.1 of [RFC2616]) πŸ™ƒ That encoding isn't really common for new text/* media types, and the special HTTP rule makes it genuinely confusing which spec ([RFC2046] or [RFC2616]) is the authority on the default charset for text/* types. Main character problem, honestly.

Then you've got complex text subtypes like "text/html" [RFC2854] and "text/xml" [RFC3023] that can describe their own charset inside the format itself. Lots of existing User Agents just ignore the "US-ASCII" default rule for at least "text/html" and "text/xml" πŸ’€

So this doc changes the RFC 2046 rules about default charset values for text/* media types, to match what clients and servers already do. It does not change the defaults for any currently registered media type πŸ¦‹

2. Conventions Used in This Document πŸ“–

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

3. New Rules for Default "charset" Parameter Values for "text/*" Media Types πŸŽ€

Here's what RFC 2046 said, verbatim:

The default character set, which must be assumed in the absence of a charset parameter, is US-ASCII.

As we covered in the Introduction, that rule is outdated, so this doc swaps it out for the following set of rules πŸ’…

Each subtype of the "text" media type that uses the "charset" parameter can define its own default value for the "charset" parameter, including the absence of any default.

To improve interoperability with deployed agents, "text/*" media type registrations SHOULD either

a. specify that the "charset" parameter is not used for the defined subtype, because the charset information is transported inside the payload (such as in "text/xml"), or

b. require explicit unconditional inclusion of the "charset" parameter, eliminating the need for a default value.

Going with option (a), registrations for "text/*" media types that can carry charset info inside their payloads (like "text/html" and "text/xml") SHOULD NOT specify the use of a "charset" parameter, nor any default value. The reason is to avoid conflicting interpretations if the "charset" parameter value and the value in the payload disagree πŸ™ˆ

So new subtypes of the "text" media type SHOULD NOT define a default "charset" value. If there's a strong reason to do it anyway, they SHOULD use the "UTF-8" [RFC3629] charset as the default.

Whichever approach you pick, all new "text/" registrations MUST clearly specify how the charset is determined. Relying on the default defined in Section 4.1.2 of [RFC2046] is no longer permitted 🚫 Existing "text/" registrations that fail to specify how the charset is determined still default to US-ASCII, though.

Specifications covering the "charset" parameter, and which default value (if any) gets used, are subtype-specific, NOT protocol-specific. Protocols that use MIME therefore MUST NOT override default charset values for "text/*" media types to be different for their specific protocol. The protocol definitions MUST leave that to the subtype definitions πŸ‘‘

4. Default "charset" Parameter Value for "text/plain" Media Type 🌈

The default "charset" parameter value for "text/plain" is unchanged from [RFC2046] and remains "US-ASCII". Nothing new to see here ⭐

5. Security Considerations πŸ”₯

Guessing the "charset" parameter can lead to real security issues, like content buffer overflows, denial of service, or bypassing filtering mechanisms. This is serious, bestie 😭 However, this document does not promote guessing. It encourages using the charset information that's specified by the sender.

Conflicting information in-band vs. out-of-band can also lead to similar security problems, so this document recommends using the charset information that's more likely to be correct (for example, in-band over out-of-band).

6. IANA Considerations 🧾

IANA has updated the "text" subregistry of the Media Types registry (http://www.iana.org/assignments/media-types/text/) to add the following preamble: "See [RFC6657] for information about 'charset' parameter handling for text media types."

IANA also added this RFC to the list of references at the beginning of the Application for Media Type (http://www.iana.org/form/media-types).

7. References πŸ“š

7.1. Normative References

[RFC2046]  Freed, N. and N. Borenstein, "Multipurpose Internet Mail
           Extensions (MIME) Part Two: Media Types", RFC 2046,
           November 1996.

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC3629]  Yergeau, F., "UTF-8, a transformation format of ISO
           10646", STD 63, RFC 3629, November 2003.

7.2. Informative References

[RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
           Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
           Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

[RFC2854]  Connolly, D. and L. Masinter, "The 'text/html' Media
           Type", RFC 2854, June 2000.

[RFC3023]  Murata, M., St. Laurent, S., and D. Kohn, "XML Media
           Types", RFC 3023, January 2001.

Appendix A. Acknowledgements 🫢

Huge thanks to Ned Freed and John Klensin for the comments and ideas that motivated this document, and to Carsten Bormann, Murray S. Kucherawy, Barry Leiba, and Henri Sivonen for feedback and text suggestions. Iconic squad πŸ₯Ήβœ¨

Authors' Addresses πŸ’Œ

Alexey Melnikov
Isode Limited
5 Castle Business Village
36 Station Road
Hampton, Middlesex  TW12 2BX
UK

EMail: Alexey.Melnikov@isode.com


Julian F. Reschke
greenbytes GmbH
Hafenweg 16
Muenster, NW  48155
Germany

EMail: julian.reschke@greenbytes.de
URI:   http://greenbytes.de/tech/webdav/
πŸ“¦ where this page comes from