Search code examples
icalendar

Commas in SUMMARY icalendar


Is it ok to have commas in a summary tag in a ics document?

Because I am using calcurse to load an .ics and it doesn't load the event with summary comma separated.


Solution

  • According to the RFC5545 Specification, Comma's need to be backslashed in that situation. See:

    SUMMARY is defined here: https://www.rfc-editor.org/rfc/rfc5545#section-3.8.1.12 as of Value Type: TEXT

    TEXT is defined here: https://www.rfc-editor.org/rfc/rfc5545#section-3.3.11

    Here is part of the above specification that describes what to do with certain characters if you want to include them in a text value:

    text       = *(TSAFE-CHAR / ":" / DQUOTE / ESCAPED-CHAR)
              ; Folded according to description above
    
           ESCAPED-CHAR = ("\\" / "\;" / "\," / "\N" / "\n")
              ; \\ encodes \, \N or \n encodes newline
              ; \; encodes ;, \, encodes ,
    
           TSAFE-CHAR = WSP / %x21 / %x23-2B / %x2D-39 / %x3C-5B /
                        %x5D-7E / NON-US-ASCII
              ; Any character except CONTROLs not needed by the current
              ; character set, DQUOTE, ";", ":", "\", ","
    
       Description:  If the property permits, multiple TEXT values are
          specified by a COMMA-separated list of values.
    
     ...
    
          The "TEXT" property values may also contain special characters
          that are used to signify delimiters, such as a COMMA character for
          lists of values or a SEMICOLON character for structured values.
          In order to support the inclusion of these special characters in
          "TEXT" property values, they MUST be escaped with a BACKSLASH
          character. ....  A COMMA character in
          a "TEXT" property value MUST be escaped with a BACKSLASH
          character.  ....