1

(I have read most threads on this issue and tried various alternatives, but I still can't solve my problem).

I am generating ical calendar events from a php script to be sent via email. This works pretty much fine; ics attachments are received, they can be opened and used to create/modify/delete calendar events. I test mostly on my iphone.

The problem I have is to include line breaks in the DESCRIPTION field: - if I generate "\n " or "\r\n " (with a space after the \n), then the whole field is displayed but as a single line. - if I generate "\n " or "\r\n ", then the characters "\n" or "\r\n" are displayed.

Also, since I read that there might be problems with ;, I tried to insert a ; in the description: when escaped with a \, it displays as \; and when not escaped, it does not cause any problem.

Here's an example of an ics attachement

BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:noreplyClickNFly@aeroclub-uaca.org
DTSTART:20180924T080000Z
DTEND:20180924T090000Z
LOCATION:Uaca
 245 Avenue Francis Tonner 06150 Cannes, France
TRANSP:OPAQUE
SEQUENCE:0
UID:20180919T190033-331242606@aeroclub-uaca.org
DTSTAMP:20180919T170033Z
SUMMARY:Baptême sur F-GJPJ
DESCRIPTION:Vol local\\r\\n PAX: John Doe (06.00.11.22.33)\\r\\n 5ème essai pour test calendrier
PRIORITY:5
CLASS:PUBLIC
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

Any suggestion will be extremely welcome.

Thanks.

Stuck
  • 11
  • 2
  • Have you looked at https://stackoverflow.com/q/666929/440290 – anmari Sep 20 '18 at 19:13
  • Yes I have (was the first one I looked at). Unfortunately, it is somewhat contradictory : some comments say you need escaping (\\n), and some say no escaping. – Stuck Sep 22 '18 at 09:05

1 Answers1

0

The only valid format to represent line breaks is \n. See https://www.rfc-editor.org/rfc/rfc5545#section-3.3.11

An intentional formatted text line break MUST only be included in a "TEXT" property value by representing the line break with the character sequence of BACKSLASH, followed by a LATIN SMALL LETTER N or a LATIN CAPITAL LETTER N, that is "\n" or "\N".

Could you include the whole email generated in your description so as to check what is actually received ?

Community
  • 1
  • 1
Arnaud Quillaud
  • 4,420
  • 1
  • 12
  • 8