escape_ical_text

Escape a value for an iCalendar TEXT property, such as SUMMARY, DESCRIPTION or LOCATION. Backslashes, commas and semicolons are escaped with a backslash. CRLF and carriage-return line endings are normalized to newlines, then escaped as the iCalendar newline sequence. Colons and double quotes remain unchanged. An undefined value produces an empty binary. Translation records use the request language and normal translation fallback. Values are converted with z_convert:to_binary/2 before escaping.

For example, in an iCalendar template:

SUMMARY:{{ id.title|unescape|escape_ical_text }}

Use unescape first for resource text containing HTML entities. Strip HTML tags before escaping rich text. This filter escapes a property value; it does not add a property name or fold content lines. The iCalendar encoder folds complete lines at 75 octets and writes CRLF line endings.

This is TEXT-value escaping, not HTML escaping or URI/parameter encoding.

Edit on GitHub