RFC 6868
Parameter Value Encoding in iCalendar and vCard
RFC 6868: Parameter Value Encoding in iCalendar and vCard π
okay bestie, this is RFC 6868, "Parameter Value Encoding in iCalendar and vCard" β¨ It's by Cyrus Daboo at Apple, dated February 2013, and it's on the Standards Track π¦ Its ISSN is 2070-1721. It updates RFC 5545, RFC 6321, RFC 6350, and RFC 6351, and its title block doesn't list any obsoleted RFCs π
Abstract πΈ
This spec updates the data formats for iCalendar (RFC 5545) and vCard (RFC 6350) so parameter values can include certain characters that the existing specs forbid π
Status of This Memo π
This is an Internet Standards Track document π
It's a product of the Internet Engineering Task Force (IETF) and represents the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG). More info on Internet Standards is in Section 2 of RFC 5741 π§
Info about the current status of this doc, any errata, and how to give feedback is at http://www.rfc-editor.org/info/rfc6868 π
Copyright Notice Β©οΈ
Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved. π
This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as in effect on the date of publication. Please read these carefully, bestie, because they describe your rights and restrictions. Code Components pulled from this doc must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License π
Table of Contents π
1. Introduction ....................................................2
2. Conventions Used in This Document ...............................2
3. Parameter Value Encoding Scheme .................................3
3.1. iCalendar Example ..........................................4
3.2. vCard Example ..............................................4
4. Security Considerations .........................................4
5. Acknowledgments .................................................4
6. Normative References ............................................5
Appendix A. Choice of Quoting Mechanism ............................6
1. Introduction β¨
okay so iCalendar [RFC5545] is the standard way to describe calendar data, and vCard [RFC6350] is the standard way to describe contact data π π―ββοΈ They both use a super similar text-based format. Every iCalendar and vCard data object can have "properties," and those properties can have "parameters" and a "value" π A parameter's value is usually a token or URI, but a "generic" text value is allowed too. The catch is that the syntax rules for both iCalendar and vCard don't let you use a double-quote character or control characters in those parameter values. Meanwhile, double-quotes and some control characters ARE allowed in actual property values, which is so unfair π
As more extensions get built on these formats, we need to allow at least double-quotes and line feeds inside parameter values π The \-escaping mechanism used for property text values isn't defined for parameter values, and it can't easily be used in a backwards-compatible way. So this spec defines a brand new character escaping mechanism. It's compatible with existing parsers and it's designed to have as little impact on existing data as possible π«Ά
2. Conventions Used in This Document π§Ύ
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119] π
3. Parameter Value Encoding Scheme π¦
So this spec makes the ^ character (U+005E, Circumflex Accent) an escape character in parameter values whose value type is defined using the "param-value" syntax element (Section 3.1 of iCalendar [RFC5545] and Section 3.3 of vCard [RFC6350]) π
The ^-escaping mechanism works whether the value is unquoted or quoted, meaning whether or not it's surrounded by double-quotes β¨
When you're generating iCalendar or vCard parameter values, these apply:
- formatted text line breaks are encoded into
^n(U+005E, U+006E) - the
^character (U+005E) is encoded into^^(U+005E, U+005E) - the
"character (U+0022) is encoded into^'(U+005E, U+0027)
When you're parsing iCalendar or vCard parameter values, these apply:
- the character sequence
^n(U+005E, U+006E) is decoded into an appropriate formatted line break according to the type of system being used - the character sequence
^^(U+005E, U+005E) is decoded into the^character (U+005E) - the character sequence
^'(U+005E, U+0027) is decoded into the"character (U+0022) - if a
^(U+005E) character is followed by any character other than the ones above, parsers MUST leave both the^and the following character in place
When converting between iCalendar and vCard text-based formats and alternative representations like XML (as described in [RFC6321] and [RFC6351], respectively), implementations MUST ensure that parameter value escape sequences are generated correctly in the text-based format and are decoded when the parameter values show up in the alternate formats π·
3.1. iCalendar Example π
This is an "ATTENDEE" property with a "CN" parameter whose value includes two double-quote characters. The parameter value isn't quoted, because nothing in the value would trigger quoting as iCalendar requires π
ATTENDEE;CN=George Herman ^'Babe^' Ruth:mailto:babe@example.com
The unescaped parameter value is:
George Herman "Babe" Ruth
3.2. vCard Example π§
This is a "GEO" property with an "X-ADDRESS" parameter whose value has several line feed characters. The parameter value is also quoted, since it contains a comma, which triggers quoting as vCard requires π
GEO;X-ADDRESS="Pittsburgh Pirates^n115 Federal St^nPitt
sburgh, PA 15212":geo:40.446816,-80.00566
The unescaped parameter value (where each line ends with a line break character sequence) is:
Pittsburgh Pirates
115 Federal St
Pittsburgh, PA 15212
4. Security Considerations π
There are no additional security issues beyond those of iCalendar [RFC5545] and vCard [RFC6350]. Literally nothing extra to panic about, bestie πβ¨
5. Acknowledgments π«Ά
Thanks to Michael Angstadt, Tim Bray, Mike Douglass, Barry Leiba, Simon Perreault, and Pete Resnick for feedback on this specification π
6. Normative References π
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC5545] Desruisseaux, B., "Internet Calendaring and Scheduling
Core Object Specification (iCalendar)", RFC 5545,
September 2009.
[RFC6321] Daboo, C., Douglass, M., and S. Lees, "xCal: The XML
Format for iCalendar", RFC 6321, August 2011.
[RFC6350] Perreault, S., "vCard Format Specification", RFC 6350,
August 2011.
[RFC6351] Perreault, S., "xCard: vCard XML Representation",
RFC 6351, August 2011.
Appendix A. Choice of Quoting Mechanism π
Okay, so once we knew parameter values needed escaping, the big question was which mechanism to use π€ One obvious pick would be to reuse the \-escaping from property values. But that can't be used as-is, because it escapes a double-quote as a \ followed by a double-quote. Let's see what the example from Section 3.1 would look like with \-escaping:
ATTENDEE;CN="George Herman \"Babe\" Ruth":mailto:babe@example.com
Existing iCalendar/vCard parsers know nothing about escape sequences in parameters π΅ So they'd parse the parameter value as:
George Herman \
That's the text between the first and second double-quote. But the text after the second double-quote ought to be either a : or a ; (to separate the parameter value from the next parameter or property), and it isn't. So the parser could legitimately throw an error right there, because the data is syntactically invalid π¨ That's why, for backwards-compatibility reasons, a double-quote can't be escaped with a sequence that itself includes a double-quote. Hence the choice of a single-quote in this spec π
Another option would be a version of \-escaping modified just for parameter values. But some incorrect, non-interoperable use of \ in parameter values has been spotted in the wild, so it's best to steer clear of it if we want guaranteed, reliable interoperability π
ββοΈ Also, since a double-quote gets changed to a single-quote in the parameter escape sequence but not in the value one, we don't want to give the impression that the same escape mechanism (and therefore the same code) works for both. That could cause other problems, like an implementation wrongly escaping a ; as \; when it should be quoting the parameter value instead π¬
The choice of ^ as the escape character came from the requirement that it be an ASCII symbol (a non-alphanumeric character), and it ought to be one least likely to show up in existing data π¦
Author's Address π
Cyrus Daboo
Apple Inc.
1 Infinite Loop
Cupertino, CA 95014
USA
EMail: cyrus@daboo.name
URI: http://www.apple.com/
π¦ where this page comes from
- ietf: rfc6868 2013-02
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms