I'm looking at an open-source PHP program which performs the following transformation to replace double-quote characters in string values:
$text = str_replace("\"", "DQUOTE", $text);
For example, the string Call me "foo".
, after this transformation, would be represented in an icalendar DESCRIPTION field like so:
DESCRIPTION:Call me DQUOTEfooDQUOTE.
My reading of various online documentation (http://www.ietf.org/rfc/rfc2445.txt and its summaries at http://www.kanzaki.com/docs/ical/) indicate that this is incorrect, and the correct representation should be
DESCRIPTION:Call me \"foo\".
What is the correct representation?
The spec at https://tools.ietf.org/html/rfc2445#section-4.3.11 indicates that double and single quotes need not be escaped at all, as does the example for the DESCRIPTION field (https://tools.ietf.org/html/rfc2445#section-4.8.1.5), so the correct representation would be
DESCRIPTION:Call me "foo".
BTW, in the time since this question was asked, the affected open-source project has fixed this issue: https://issues.civicrm.org/jira/browse/CRM-20350