collective / icalendar

icalendar parser library for Python
https://icalendar.readthedocs.io/en/latest/
Other
975 stars 167 forks source link

escaping of , char #74

Closed thet closed 11 years ago

thet commented 11 years ago

according to RFC 5545, chapter 3.3.11, these characters should be escaped:

ESCAPED-CHAR = ("\\" / "\;" / "\," / "\N" / "\n")

when adding doing the following, the comma isn't escaped:

cn = ['Max Mustermann', 'Somewhere 19', 'XYZ 1234']
ical = icalendar.Event()
ical.add('contact', u', '.join(cn))
warvariuc commented 11 years ago

The same here:

import icalendar

event =  icalendar.Event()
event['location'] = 'Moscow, city'
print event.to_ical()
event['location'] = icalendar.vText('Moscow, city')
print event.to_ical()

Result:

BEGIN:VEVENT
LOCATION:Moscow, city
END:VEVENT

BEGIN:VEVENT
LOCATION:Moscow, city
END:VEVENT