Outlook iCal meeting invitation description issue

僤鯓⒐⒋嵵緔 提交于 2020-01-05 22:12:21

问题


I am sending iCal event invitation using php. Everything displays in proper manner and RVSP button displayed correctly. But description is cutting down after first line. For example if my description is:

The problem occurs when I have multiple lines in the description. 
If it contains the text for example I will only get in my outlook calendar 
description. The part after disappears.

The only first line displays like:

The problem occurs when I have multiple lines in the description.

If someone help me. I have already wrap the lines but after first line it will not displayed. Here is code snippet.

function ical_split($preamble, $value) {
    $value = trim($value);
    $value = strip_tags($value);
    $value = preg_replace('/\n+/', ' ', $value);
    $value = preg_replace('/\s{2,}/', ' ', $value);
    $preamble_len = strlen($preamble);
    $lines = array();
    while (strlen($value)>(74-$preamble_len)) {
        $space = (74-$preamble_len);
        $mbcc = $space;
        while ($mbcc) {
            $line = mb_substr($value, 0, $mbcc);
            $oct = strlen($line);
            if ($oct > $space) {
                $mbcc -= $oct-$space;
            }
            else {
                $lines[] = $line;
                $preamble_len = 1; // Still take the tab into account
                $value = mb_substr($value, $mbcc);
                break;
            }
        }
    }
    if (!empty($value)) {
        $lines[] = $value;
    }
    return join($lines, "\\n\\t");
}

And I called it as follows:

$meeting_notes="The problem occurs when I have multiple lines in the description. If it contains the text for example I will only get in my outlook calendar description. The part after disappears."
ical_split('DESCRIPTION:', $meeting_notes)

Here the detail of attached ics file.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20150227T163000Z
DTEND:20150227T173000Z
DTSTAMP:20150211T094306Z
ORGANIZER;CN=Charlene Switzer:MAILTO:email_here
UID:40
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=name_here;X-NUM-GUESTS=0:MAILTO:email_here
DESCRIPTION:The problem occurs when I have multiple lines in the description. If it contains the text for example I will only get in my outlook calendar description. The part after disappears.
LOCATION:asdf asd
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:OPAQUE
SUMMARY:Meeting
PRIORITY:5
CLASS:PUBLIC
BEGIN:VTIMEZONE
TZID:Eastern
END:VTIMEZONE
END:VEVENT
END:VCALENDAR

回答1:


To expend on Dmitry's explanation, you need to refer to RFC5545 which specifies the iCalendar format

3.1. Content Lines

The iCalendar object is organized into individual lines of text, called content lines. Content lines are delimited by a line break, which is a CRLF sequence (CR character followed by LF character).

Lines of text SHOULD NOT be longer than 75 octets, excluding the line break. Long content lines SHOULD be split into a multiple line representations using a line "folding" technique. That is, a long line can be split between any two characters by inserting a CRLF immediately followed by a single linear white-space character (i.e., SPACE or HTAB).

So back to your question, like Dmitry's suggest you should add a TAB or a SPACE after your CRLF but also you should make sure your lines aren't longer than 75bytes.




回答2:


Make sure the second lines start with a tab (0x9) - this way the lines will be correctly unwrapped.



来源:https://stackoverflow.com/questions/28496963/outlook-ical-meeting-invitation-description-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!