It is not possible to subscribe to an Event module feed using Google Calendar. We haven't been able to make it work with iCalendar either. Is there a solution?

Comments

solipsist’s picture

Here's a copy of the ical feed. As you can see it contains non-English characters and I wonder whether they are correctly encoded and whether that could be why it doesn't work. Any ideas? Anyone who knows the iCal-spec?

BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:KogVet | September 18, 2006 - October 18, 2006
PRODID:-//strange bird labs//Drupal iCal API//EN
BEGIN:VEVENT
DTSTART;VALUE=DATE-TIME:20061014T070000Z
DTEND;VALUE=DATE-TIME:20061018T123000Z
SUMMARY:NordiCHI 2006
DESCRIPTION:&quot\;NordiCHI is the main Nordic forum for human-computer interaction research. NordiCHI is the meeting place for researchers from academia and industry\, designers\, practitioners\, educators and others from a broad range of traditions and communities.&quot\; 
 
 I år hålls konferensen i Oslo. För studenter är priset €350 + ev workshops. Mer info på http":"//www.nordichi.org/2006
URL;VALUE=URI:http://www.kogvet.whileidle.com/kalender/nordichi_2006
UID:http://www.kogvet.whileidle.com/kalender/nordichi_2006
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE-TIME:20061015T130000Z
DTEND;VALUE=DATE-TIME:20061016T190000Z
SUMMARY:Sjöslaget
DESCRIPTION:Åk båt till finland!
URL;VALUE=URI:http://www.kogvet.whileidle.com/kalender/sjoslaget
UID:http://www.kogvet.whileidle.com/kalender/sjoslaget
END:VEVENT
END:VCALENDAR
killes@www.drop.org’s picture

please look at the ical RFP to find out what encoding is required.

solipsist’s picture

From:
http://tools.ietf.org/html/rfc2445#page-10

3.4 Encoding Considerations

   This MIME content type can contain 8bit characters, so the use of
   quoted-printable or BASE64 MIME content-transfer-encodings might be
   necessary when iCalendar objects are transferred across protocols
   restricted to the 7bit repertoire. Note that a text valued property
   in the content entity can also have content encoding of special
   characters using a BACKSLASH character (US-ASCII decimal 92)
   escapement technique. This means that content values can end up
   encoded twice.
karens’s picture

What's needed is to encode the description like:

DESCRIPTION;ENCODING=QUOTED-PRINTABLE:

Not sure if there is already a drupal function somewhere that can do a quoted-printable encoding. I used to have one that worked, but can't find it right now. Maybe some else has one, but I'll keep looking for it...

karens’s picture

Here is the PEAR function for quoted printable encoding (from PEAR mail/mimePart.php):

<code>
    /**
     * quoteadPrintableEncode()
     *
     * Encodes data to quoted-printable standard.
     *
     * @param $input    The data to encode
     * @param $line_max Optional max line length. Should
     *                  not be more than 76 chars
     *
     * @access private
     */
    function _quotedPrintableEncode($input , $line_max = 76)
    {
        $lines  = preg_split("/\r?\n/", $input);
        $eol    = MAIL_MIMEPART_CRLF;
        $escape = '=';
        $output = '';

        while(list(, $line) = each($lines)){

            $linlen     = strlen($line);
            $newline = '';

            for ($i = 0; $i < $linlen; $i++) {
                $char = substr($line, $i, 1);
                $dec  = ord($char);

                if (($dec == 32) AND ($i == ($linlen - 1))){    // convert space at eol only
                    $char = '=20';

                } elseif(($dec == 9) AND ($i == ($linlen - 1))) {  // convert tab at eol only
                    $char = '=09';
                } elseif($dec == 9) {
                    ; // Do nothing if a tab.
                } elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) {
                    $char = $escape . strtoupper(sprintf('%02s', dechex($dec)));
                }

                if ((strlen($newline) + strlen($char)) >= $line_max) {        // MAIL_MIMEPART_CRLF is not counted
                    $output  .= $newline . $escape . $eol;                    // soft line break; " =\r\n" is okay
                    $newline  = '';
                }
                $newline .= $char;
            } // end of for
            $output .= $newline . $eol;
        }
        $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf
        return $output;
    }


You need to run the text through that function, and put DESCRIPTION;ENCODING=QUOTED-PRINTABLE: in front of it in the ical file instead of just DESCRIPTION; You should do the same on SUMMARY.

If I have time, I'll try to make this into a patch.

solipsist’s picture

Thanks Karen! I'll try this!

karens’s picture

Status: Active » Needs review
StatusFileSize
new3.02 KB

Try this patch... (need quoted printable on the location, too, I think. It should be anywhere there could be text).

killes@www.drop.org’s picture

is the PEAR code GPL? I know they use a variety of licenses.

karens’s picture

Not sure, but we have PEAR code included in other modules (rightly or wrongly). If the license is a problem, I guess we have to write our own function that does the same thing.

karens’s picture

Here's what the PEAR file says. I don't know how to interpret it.

// +-----------------------------------------------------------------------+
// | Copyright (c) 2002-2003  Richard Heyes                                     |
// | All rights reserved.                                                  |
// |                                                                       |
// | Redistribution and use in source and binary forms, with or without    |
// | modification, are permitted provided that the following conditions    |
// | are met:                                                              |
// |                                                                       |
// | o Redistributions of source code must retain the above copyright      |
// |   notice, this list of conditions and the following disclaimer.       |
// | o Redistributions in binary form must reproduce the above copyright   |
// |   notice, this list of conditions and the following disclaimer in the |
// |   documentation and/or other materials provided with the distribution.|
// | o The names of the authors may not be used to endorse or promote      |
// |   products derived from this software without specific prior written  |
// |   permission.                                                         |
// |                                                                       |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
// |                                                                       |
// +-----------------------------------------------------------------------+
// | Author: Richard Heyes <richard@phpguru.org>                           |
killes@www.drop.org’s picture

A non-GPL compatible license would be a problem yes. Drupal core doesn't use any PEAR code, so it is the task of module maintainers to ensure they not breach somebody's license.

If the code is GPL, we should at lease rename the function in order to avoid a namespace conflct should somebody use PEAR and Drupal.

karens’s picture

I had my own version of a function to do this. I'll dig it out and use it instead, then this won't be an issue.

karens’s picture

StatusFileSize
new2.97 KB

Here's a patch with a function I put together from code I have used before, named appropriately for the module so there are no name clashes.

karens’s picture

StatusFileSize
new2.92 KB

Uploaded wrong file, use this patch instead.

killes@www.drop.org’s picture

:)

solipsist, cab you test this latest patch?

solipsist’s picture

Sure thing! Thanks Karen and Killes for your time and efforts!

solipsist’s picture

Hoolabaloola! It seems to work! I've confirmed it works with Google Calendar.

Here's the output:

BEGIN:VCALENDAR
VERSION:2.0
X-WR-CALNAME:KogVet | September 19, 2006 - October 19, 2006
PRODID:-//strange bird labs//Drupal iCal API//EN
BEGIN:VEVENT
DTSTART;VALUE=DATE-TIME:20061014T070000Z
DTEND;VALUE=DATE-TIME:20061018T123000Z
SUMMARY;ENCODING=QUOTED-PRINTABLE:NordiCHI 2006
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:&quot\;NordiCHI is the main Nordic forum for human-computer interaction rese=
arch. NordiCHI is the meeting place for researchers from academia and indus=
try, designers, practitioners, educators and others from a broad range of t=
raditions and communities.&quot\;=20=0D=0A=0D=0AI =C3=A5r h=C3=A5lls konferensen i Oslo. F=C3=B6r studenter =C3=A4r priset =
=E2=82=AC350 + ev workshops. Mer info p=C3=A5 http\://www.nordichi.org/2006
URL;VALUE=URI:http://www.kogvet.whileidle.com/kalender/nordichi_2006
UID:http://www.kogvet.whileidle.com/kalender/nordichi_2006
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE-TIME:20061015T130000Z
DTEND;VALUE=DATE-TIME:20061016T190000Z
SUMMARY;ENCODING=QUOTED-PRINTABLE:Sj=C3=B6slaget
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=C3=85k b=C3=A5t till Finland!
URL;VALUE=URI:http://www.kogvet.whileidle.com/kalender/sjoslaget
UID:http://www.kogvet.whileidle.com/kalender/sjoslaget
END:VEVENT
END:VCALENDAR

Thanks a million Karen! Great work! Killes, I'm so happy we can finally harness the full power of this module!

killes@www.drop.org’s picture

Status: Needs review » Fixed

applied

solipsist’s picture

Title: Event feed doesn't work with Google Calendar nor iCal » Still not working
Status: Fixed » Active

Apparently my initial report was wrong. Google Calendar shows an error message when I try to add this iCal-calendar:
webcal://www.kogvet.se/event/ical/all/all

It may be the character encoding or it may be something else. I stripped the calendar of any non-English chars before and that was when it worked. I didn't realize that until later. Now the character encoding may actually be wrong here, I don't know. Any theories?

solipsist’s picture

Title: Still not working » Google Calendar still chokes when trying to subscribe to ical
StatusFileSize
new3.09 KB

Follow-up: I've attached a screenshot of the error message I get at Google Calendar when trying to add the ical feed as a public calendar. The error message is a change because before the patch et c, when the calendar was added there was no error message, but nothing showed either.

karens’s picture

I'll take another look at this when I have time, but can't do it right now. The use of quoted-printable is definitely needed here, just need to see what else might be the problem (could be some problem in the conversion of certain special characters). In the meantime, could you post an example of something that did not work that could be used to test it?

karens’s picture

I mean an example of text that did not work, rather than a screen shot.

solipsist’s picture

StatusFileSize
new4.63 KB

I wish I knew what doesn't work. Your text-encoding was definitely needed but like you wrote, there's something else going on here. I've attached a copy of the feed which Google Calendar cannot parse. I tried opening it in Sunbird and Lightning but couldn't, not sure if it was because of the feed itself or them not supporting the format.

Been looking around for a spec and a way to validate the feed but haven't come up with anything. Maybe someone else knows?

solipsist’s picture

Good documentation of the format: http://en.wikipedia.org/wiki/ICalendar

solipsist’s picture

I have a theory... iCal uses CRLF to separate data, but several of our posts have linebreaks in then. Karen, can you BASE64 code these CRLFs so that the file doesn't break the standard?

solipsist’s picture

Here's an example:

DESCRIPTION;ENCODING=QUOTED-PRINTABLE:<p>Nu =C3=A4r det dags f=C3=B6r f=C3=B6retagsseminarium! Denna g=C3=A5ng ha=
r SAKS (Sektionen f=C3=B6r Systemvetenskap) bjudit in Oracle som kommer att=
 prata om vad de g=C3=B6r nu, vad de erbjuder f=C3=B6r tj=C3=A4nster, hur d=
essa fungerar och vad de har f=C3=B6r planer inf=C3=B6r framtiden.</p><p>De=
 kommer sj=C3=A4lvklart =C3=A4ven svara p=C3=A5 fr=C3=A5gor fr=C3=A5n oss s=
tudenter.</p><p>Seminariet kommer att h=C3=A5llas i C1 (I Colloseum, C-huse=
t) den 28 september, kl. 17\:00 och =C3=A4r gratis!</p><p>F=C3=B6r att anm=
=C3=A4la dig ska du g=C3=A5 in p=C3=A5 adressen\:<br />http\://www.saksaren.s=
e/oracle.php</p><p>och anv=C3=A4nd dessa inloggningsuppgifter\:</p><p>User N=
ame\: saks<br />Password\: saksare</p>
URL;VALUE=URI:http://www.kogvet.se/kalender/oracleseminarium
UID:http://www.kogvet.se/kalender/oracleseminarium
END:VEVENT

should be:

DESCRIPTION;ENCODING=QUOTED-PRINTABLE:<p>Nu =C3=A4r det dags f=C3=B6r f=C3=B6retagsseminarium! Denna g=C3=A5ng ha=r SAKS (Sektionen f=C3=B6r Systemvetenskap) bjudit in Oracle som kommer att= prata om vad de g=C3=B6r nu, vad de erbjuder f=C3=B6r tj=C3=A4nster, hur d=essa fungerar och vad de har f=C3=B6r planer inf=C3=B6r framtiden.</p><p>De= kommer sj=C3=A4lvklart =C3=A4ven svara p=C3=A5 fr=C3=A5gor fr=C3=A5n oss s=tudenter.</p><p>Seminariet kommer att h=C3=A5llas i C1 (I Colloseum, C-huse=t) den 28 september, kl. 17\:00 och =C3=A4r gratis!</p><p>F=C3=B6r att anm==C3=A4la dig ska du g=C3=A5 in p=C3=A5 adressen\:<br />http\://www.saksaren.s=e/oracle.php</p><p>och anv=C3=A4nd dessa inloggningsuppgifter\:</p><p>User N=ame\: saks<br />Password\: saksare</p>
URL;VALUE=URI:http://www.kogvet.se/kalender/oracleseminarium
UID:http://www.kogvet.se/kalender/oracleseminarium
END:VEVENT

I tried changing it to HTML to rid if of the additional CRLFs, replacing them with
but it didn't seem to work. I'll need a code solution to this.

solipsist’s picture

Here's an exampel of a wel-formed entry:

    BEGIN:VCALENDAR
    VERSION:2.0
    PRODID:-//ABC Corporation//NONSGML My Product//EN
    BEGIN:VJOURNAL
    DTSTAMP:19970324T120000Z
    UID:uid5@host1.com
    ORGANIZER:MAILTO:jsmith@host.com
    STATUS:DRAFT
    CLASS:PUBLIC
    CATEGORY:Project Report, XYZ, Weekly Meeting
    DESCRIPTION:Project xyz Review Meeting Minutes\n
     Agenda\n1. Review of project version 1.0 requirements.\n2.
    Definition
     of project processes.\n3. Review of project schedule.\n
     Participants: John Smith, Jane Doe, Jim Dandy\n-It was
      decided that the requirements need to be signed off by
      product marketing.\n-Project processes were accepted.\n
     -Project schedule needs to account for scheduled holidays
      and employee vacation time. Check with HR for specific
      dates.\n-New schedule will be distributed by Friday.\n-
     Next weeks meeting is cancelled. No meeting until 3/23.
    END:VJOURNAL
    END:VCALENDAR

A simple string replacement should do the job. I'm gonna try it.

solipsist’s picture

After changing the code back, using the replacement function in ical.inc to replace CRLFs (\r\n) with \\n, it works, at least in Sunbird. It likes the .ics files now, it imports it right but it doesn't recognize or get the character encoding right.

Google Calendar can't even parse it now.

solipsist’s picture

According to my friend who runs iCal on a Mac with a Swedish version of Mac OS X, he can import and subscribe to the ical feed, but the characters do not appear as they are instead he sees the encoded characters instead of the actual. Apparently iCal fails to recognize the encoding.

solipsist’s picture

Lots of posts today! :)

Anyway, line breaks should be okay now that I replaced all "\r\n" with "\\n". Character encoding may be the actual problem here, issues with UTF-8 et c.

Found this which may be of some help:
http://phpicalendar.net/forums/archive/index.php/t-1252.html

Also worth looking into for code and ideas:
http://phpicalendar.net

solipsist’s picture

Strange, it works now with Google Calendar as well but with one problem, it shows characters in BASE64, doesn't get the encoding right either so I think the BASE64 encoding Karen implemented needs tweaking. Tomorrow I'm gonna look at how phpicalendar does it.

solipsist’s picture

StatusFileSize
new1.03 KB

After investigating by
1) adding the feed to Google Calendar, seen it work except for the BASE 64 encoding, and also learnt that GCal doesn't update very frequently which is why I haven't been able to see the results of my changes right away
2) and used an application called eventSherpa to try parsing the feeds
3) and comparing the ical feed from my Google Calendar to the one generated by the event module and the RFC and comments found in Wikipedia

I have three theories:

- The RFC says lines should be terminated by CRLF, in escaped chars that's \r\n, the event module terminates the lines with \n, I am now rewriting it to follow the RFC.

- The RFC also says that CRLFs and CRs within fields should be replaced by \n, this is what Google Calendar does and eventSherpa parses this feed correctly

- By comparing a google ics file with the events module ics file I've noticed there are discrepancies what fields are concerned, fields determing time zone and calendar (gregorian or julian) to mention two. Whether these fields are required for an ical feed to be parsed correctly by most calendar applications, I cannot say, but missing fields could be one reason.

- Character encoding doesn't seem to be done with BASE 64, Google uses regular UTF-8 and it works with eventSherpa, which is what the event module does without Karen's code

So there's a lot of detective work left to do. I'll have to read the RFC more carefully now.

I've attached the ics from Google Cal with my calendar with a demo event with non-English chars and linebreaks, this ical feed IS parsed by eventSherpa.

I've also attached an ics from our site (see next post), generated by the event module with my modifications, this feed is NOT parsed by eventSherpa.

Comments and ideas are most welcome!

solipsist’s picture

StatusFileSize
new4.52 KB

This is the second file, the one that DOES NOT parse.

solipsist’s picture

Here are the error messages iCal generates with the feed I've got now (the ICS attached above):

2006-09-22 13:53:34.902 iCal[375] Date validation error: DTSTART = '19700329T020000
'
2006-09-22 13:53:34.903 iCal[375] iCalendar recurrence failure FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
line 1:33: unexpected char: 0x0D
2006-09-22 13:53:34.903 iCal[375] Date validation error: DTSTART = '19701025T030000
'
2006-09-22 13:53:34.903 iCal[375] iCalendar recurrence failure FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
line 1:34: unexpected char: 0x0D
2006-09-22 13:53:34.903 iCal[375] Date validation error: DTSTART = '20060928T150000Z
'
2006-09-22 13:53:34.903 iCal[375] Date validation error: DTEND = '20060928T170000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTSTART = '20060928T200000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTEND = '20060928T200000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTSTART = '20061005T170000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTEND = '20061005T170000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTSTART = '20061005T200000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTEND = '20061005T200000Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTSTART = '20061009T081500Z
'
2006-09-22 13:53:34.904 iCal[375] Date validation error: DTEND = '20061009T100000Z
'
2006-09-22 13:53:34.905 iCal[375] Date validation error: DTSTART = '20061010T131500Z
'
2006-09-22 13:53:34.905 iCal[375] Date validation error: DTEND = '20061010T160000Z
'
2006-09-22 13:53:34.905 iCal[375] Date validation error: DTSTART = '20061014T070000Z
'
2006-09-22 13:53:34.905 iCal[375] Date validation error: DTEND = '20061018T123000Z
'
2006-09-22 13:53:34.905 iCal[375] Date validation error: DTSTART = '20061015T130000Z
'
2006-09-22 13:53:34.905 iCal[375] Date validation error: DTEND = '20061016T190000Z
'
2006-09-22 13:53:34.905 iCal[375] Component boundaries mismatch (VCALENDAR VCALENDAR
)
solipsist’s picture

markstos’s picture

Title: Google Calendar still chokes when trying to subscribe to ical » ical feeds not wrapping properly

I think I've found a definite bug in ICal feed generation with 1.3.2.4 of ical.inc. First, it seems that 1.3.2.3 worked better for me with Google Calendar. With it, I was able to see complete descriptions, while 1.3.2.4 only shows the first line, ending with "=". The following may explain way.

In the spec ( http://www.ietf.org/rfc/rfc2445.txt) , we find this:

"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, US-ASCII decimal 32 or HTAB, US-ASCII decimal 9). Any sequence
of CRLF followed immediately by a single linear white space character
is ignored (i.e., removed) when processing the content type.

For example the line:

DESCRIPTION:This is a long description that exists on a long line.

Can be represented as:

DESCRIPTION:This is a lo
ng description
that exists on a long line.
"

However, "ical.inc" current does follow this spec, as this example shows:

DESCRIPTION;ENCODING=QUOTED-PRINTABLE:<p>For three years now, the Co-op has held an bazaar which showcases local =
artistry and crafts, as well as  international gifts, holiday cards, calend=
ars and more.  Saturday December 9th will be a lively festive day at the Co=
-op.  As usual we will have items from Richmond folks and Earlhamites, fair=

##

Using the "ENCODING=QUOTED-PRINTABLE" does not allow you to avoid the line-wrapping rule above. For example, since this spec description:

http://www.kanzaki.com/docs/ical/encoding.html

Here they provide an example of a BASE64 encoding that still has the line wrapping in place.

There may be other bugs lurking, but I hope this is enough to solve the line-wrapping issue!

ATTACH;FMTYPE=IMAGE/JPEG;ENCODING=BASE64;VALUE=BINARY:MIICajC
   CAdOgAwIBAgICBEUwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDA
   qBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMRw

###

One more thing! The 72 character rule seems to apply to /any/ data, including parts like:
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:
That should be figured into line-wrapping as well, I think. It least, it seems to be in the examples I found.

I hope that's enough detail to solve this bug!

Mark

markstos’s picture

Title: ical feeds not wrapping properly » example code for ical property wrapping

This might be helpful. It's some GPL'ed code that handles ical folding, and in particular has some comments related to QUOTED printable.

The funtion is "sub _fold" from here:
http://search.cpan.org/src/JESSE/Data-ICal-0.11/lib/Data/ICal/Property.pm

Here's the juicy part. (Yes, it's Perl, not PHP, but should be easy to translate. )

=begin private

=head2 _fold $string

Returns C<$string> folded with newlines and leading whitespace so that each
line is at most 75 characters.

(Note that it folds at 75 characters, not 75 bytes as specified in the standard.)

If this is vCalendar 1.0 and encoded with QUOTED-PRINTABLE, folds with = instead.

=end private

=cut

sub _fold {
    my $self   = shift;
    my $string = shift;

    my $quoted_printable = $self->vcal10 && 
        uc $self->parameters->{'ENCODING'} eq 'QUOTED-PRINTABLE';

    # We can't just use a s//g, because we need to include the added space/= and
    # first character of the next line in the count for the next line.

    if ($quoted_printable) {
        # In old vcal, quoted-printable properties have different folding rules.
        # But some interop tests suggest it's wiser just to not fold for vcal 1.0
        # at all (in quoted-printable).

        # [do nothing]

#        while ( $string =~ /.{75}[^\n=]/ ) {
#            $string =~ s/(.{75})([^\n=])/$1=\n$2/;
#        }
    } else {
        while ( $string =~ /(.{76})/ ) {
            $string =~ s/(.{75})(.)/$1\n $2/;
        }
    }

    return $string;
}
westbywest’s picture

I've been working with this problem myself and found that the hosting webserver (i.e. Apache) may need to be configured to correctly handle .ics format.

For linux, add the following to /etc/mime.types:

text/calendar ics

Otherwise, you could add the following to Apache's httpd.conf:

AddType text/calendar .ics

This fixed my problem importing the event module's ical feed into Google calendar.

killes@www.drop.org’s picture

there indeed seems to be some kind of error. While all the Umluats were correktly displayed in sunbird, the colons weren't. Each colon is displayed surrounded by double quotes. Very strange.

geodaniel’s picture

This could go back to issues introduced by the patch I suggested back in May last year as well... http://drupal.org/node/61830

geodaniel’s picture

Title: example code for ical property wrapping » Event feed doesn't work with Google Calendar nor iCal

We should probably also be stripping HTML from the feeds and replacing paragraphs with \n\n, right?

karens’s picture

See a patch posted at http://drupal.org/node/61830. That got import into Google Calendar working for me and it would be good to have others test it. Actually one of these issues should probably be posted as a duplicate of the other, but not sure which should be the one to survive.

geodaniel’s picture

Status: Active » Closed (duplicate)

Lets set this as a duplicate now that killes has applied your patch in the other issue this morning. Thanks for your work on this!