1

我正在iCal event使用 发送邀请php。一切都以正确的方式显示,RVSP按钮显示正确。不过descriptioncutting down之后first line。例如,如果我的描述是:

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 problem occurs when I have multiple lines in the description.

如果有人帮助我。我已经换行了,但是在第一行之后它不会显示。这是代码片段。

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");
}

我这样称呼它:

$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)

这里是附件 ics 文件的详细信息。

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
4

2 回答 2

2

要扩展 Dmitry 的解释,您需要参考指定 iCalendar 格式的 RFC5545

[3.1。内容行][1]

iCalendar 对象被组织成单独的文本行,称为内容行。内容行由换行符分隔,换行符是一个 CRLF 序列(CR 字符后跟 LF 字符)。

文本行不应超过 75 个八位字节,不包括换行符。长内容行应该使用行“折叠”技术拆分为多行表示。也就是说,可以通过插入紧跟单个线性空白字符(即,SPACE 或 HTAB)的 CRLF,在任意两个字符之间分割长行。

所以回到你的问题,就像德米特里建议你应该在你的 CRLF 之后添加一个TAB或一个SPACE,但你应该确保你的行不超过 75 字节。[1]:https ://www.rfc-editor.org/rfc/rfc5545#section-3.1

于 2015-02-14T17:10:10.190 回答
0

确保第二行以制表符 (0x9) 开头 - 这样行将正确展开。

于 2015-02-13T16:34:32.763 回答