Answers.Body: <p>The issue has been solved with help I got on the civiCRM repo. (<a href="https://lab.civicrm.org/dev/wordpress/issues/25" rel="nofollow noreferrer">https://lab.civicrm.org/dev/wordpress/issues/25</a>).</p>
  
  <ol>
  <li>First I found two files in my site that are loaded on every page that contain a BOM.</li>
  </ol>
  
  <p><code>find . -type f -printf "%p " -a -exec od -x -N 4 \{\} \; | grep "bbef 3cbf"</code></p>
  
  <ol start="2">
  <li>Secondly I removed those BOMs with vim.</li>
  </ol>
  
  <p>Edit the files (which in my case where the <code>functions.php</code> and <code>header.php</code> file of my theme) with vim. Type <code>:set nobomb</code> and save the files.</p>
  
  <p>Now I can use the ical url of my site and it will load in virtual calendars.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T23:11:27.517Z
Answers.Text: Ha ha you might not have noticed I'm the same person, the same way you have different usernames. No worries.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-02T13:40:57.510Z
Answers.Text: Haha, thanks for your help!
Answers.UserDisplayName: Sam Simons
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T23:02:04.667Z
Answers.LastActivityDate: 2019-05-31T23:02:04.667Z
Answers.UserDisplayName: Sam Simons
Answers.Body: <p>As discussed in <a href="https://lab.civicrm.org/dev/wordpress/issues/25" rel="nofollow noreferrer">https://lab.civicrm.org/dev/wordpress/issues/25</a> and using a different grep since the grep linked to in the comments above doesn't seem to work, there were two theme files with a BOM.</p>
  
  <p>This grep</p>
  
  <p><code>find . -type f -printf "%p " -a -exec od -x -N 4 \{\} \; | grep "bbef 3cbf"</code></p>
  
  <p>located</p>
  
  <p><code>wp-content/themes/ari/functions.php
  wp-content/themes/ari/header.php</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T19:07:12.480Z
Answers.LastActivityDate: 2019-05-31T19:07:12.480Z
Answers.UserDisplayName: Demerit
Body: <p>I would really like to use CiviCRM's function to create an ical feed for the calendar. But I'm having some hard times to get it working.</p>
  
  <p>The event has a title, a date, a custom category and a 'long description'. When you visit the url to the ical feed: <a href="https://example.tld/civicrm?page=CiviCRM&amp;q=civicrm%2Fevent%2Fical&amp;reset=1" rel="nofollow noreferrer">https://example.tld/civicrm?page=CiviCRM&amp;q=civicrm%2Fevent%2Fical&amp;reset=1</a></p>
  
  <p>you get the following .ics file</p>
  
  <p>civicrm_ical.ics</p>
  
  <pre><code>BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
  X-WR-TIMEZONE:Europe/Amsterdam
  METHOD:PUBLISH
  BEGIN:VEVENT
  UID:CiviCRM_EventID_4_215ca88ba6fc880ae683205e6cd7bc8d@example.tld
  SUMMARY:Test-event
  DESCRIPTION:Some description
  CATEGORIES:ALV
  CALSCALE:GREGORIAN
  DTSTAMP;VALUE=DATE-TIME:20190401T200000
  DTSTART;VALUE=DATE-TIME:20190401T200000
  DTEND;VALUE=DATE-TIME:20190402T030000
  URL:https://example.tld/civicrm/?page=CiviCRM&amp;q=civicrm%2Fevent%2Finfo&amp;reset=1&amp;id=4
  END:VEVENT
  END:VCALENDAR
  </code></pre>
  
  <p>But when I use the url of the feed in fastmail or google calendar for instance, an error appears, or the calendar items do not appear. What could be the problem?</p>
  
  <p>I use CiviCRM 5.10.3 on Wordpress.</p>
  
  <p>Kind regards,</p>
  
  <p>Sam</p>
  
  <p>--- edit ---</p>
  
  <p>I got the following error message from Fastmail, my mailprovider.</p>
  
  <blockquote>
    <p>Syncing to your [redacted] calendar has been disabled: [ad2278bd-7237-4dee-884f-4eff6f3666bc] The calendar data was invalid: Error parsing VCalendar data: error Closed a different card name than opened at line 7 char 0:</p>
  
  <pre><code>---&gt; ï»¿BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
  X-WR-TIMEZONE:Europe/Amsterdam
  METHOD:PUBLISH
  END:VCALENDAR
   &lt;--- at /usr/lib/x86_64-linux-gnu/perl5/5.20/Text/VCardFast.pm line 55.
  
  BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
  X-WR-TIMEZONE:Europe/Amsterdam
  METHOD:PUBLISH
  END:VCALENDAR
   at /home/mod_perl/hm/ME/CalDAVTalk.pm line 1427.
      ME::CalDAVTalk::_getEventsFromVCalendar(ME::CalDAV=HASH(0x8601578), "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"...) called at /home/mod_perl/hm/ME/CalDAVTalk.pm line 2554
      ME::CalDAVTalk::vcalendarToEvents(ME::CalDAV=HASH(0x8601578), "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"...) called at /home/mod_perl/hm/ME/CalDAV.pm line 1434
      eval {...} called at /home/mod_perl/hm/ME/CalDAV.pm line 1433
      ME::CalDAV::syncFromIcal(ME::CalDAV=HASH(0x8601578), "b8285308-2a18-4c47-9d22-fae8d8798d21", "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"..., HASH(0x89e5670), "Force", 0, "ReadUidPrefix", "913888i-") called at /home/mod_perl/hm/ME/CalDAV.pm line 1904
      eval {...} called at /home/mod_perl/hm/ME/CalDAV.pm line 1867
      ME::CalDAV::syncCalendar(ME::CalDAV=HASH(0x8601578), 913888, "Force", 0) called at /home/mod_perl/hm/scripts/caldav_sync.pl line 271
      main::SyncCalendar(ME::User=HASH(0x89bea78)) called at /home/mod_perl/hm/scripts/caldav_sync.pl line 98
  </code></pre>
  </blockquote>
  
  <p>I have no idea what to make of this. There are currently no events in the calendar.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-27T15:57:56.330Z
Comments.Text: For google, it might just be a delay. For example if you import the file, as a file import not a feed, you need to then close google calendar and reopen it to see the event. The feed maybe takes its own time. See here where it says "add using a link" https://support.google.com/calendar/answer/37100?hl=en&ref_topic=1672445. It says it might take 12 hours. When you say you get an error, what error do you get?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-28T16:28:58.253Z
Comments.Text: i don't seem to get an error no more. but also after several days the calendar items are not loading. am i missing something obvious? what do you make of the ical-feed and its url, they're alright, right?
Comments.UserDisplayName: Sam Simons
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-28T16:37:57.400Z
Comments.Text: It looks ok, and it does import into google as a file. A crazy workaround might be to set up the feed on your phone or somewhere where it does work, then set up that calendar to sync to the google calendar.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-08T11:29:20.937Z
Comments.Text: I just got the error from Fastmail. Do you have an idea what to make of it?
Comments.UserDisplayName: Sam Simons
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T17:50:16.967Z
Comments.Text: I got a response from Fastmail. The engineers there found out that the problem is the following:
  
  "The problem is that your ics file begins with a UTF-8 Byte order mark or BOM — https://en.wikipedia.org/wiki/Byte_order_mark
  
  Our server did not know what to do with this, but we've fixed it and now you should be all set.
  
  I don't think it's typical to provide these in ics files, but we should have been able to handle it just the same."
  
  So this seems to be an issue of CiviCRM, I opened an issue on their Gitlab: https://lab.civicrm.org/dev/wordpress/issues/25 .
Comments.UserDisplayName: Sam Simons
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T18:25:15.893Z
Comments.Text: That usually happens when you have an extension or maybe even your civicrm.settings.php file that contains a BOM, so it gets output from there. Use the `grep` listed here (not the `find`) to see if there is one: https://stackoverflow.com/a/2858757/8332458
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-06T08:00:12.190Z
Comments.Text: See also https://civicrm.stackexchange.com/questions/30482/ical-feed-doesnt-work-lots-of-public-events-but-none-found ?
Comments.UserDisplayName: Chris Burgess
Tags: <wordpress><civievent><calendar>
Title: Problem with the ical feed of the calendar
ThreadText: # Problem with the ical feed of the calendar
  
  (Asked by: username_0 on 2019-03-27)
  
  I would really like to use CiviCRM's function to create an ical feed for the calendar. But I'm having some hard times to get it working.
  The event has a title, a date, a custom category and a 'long description'. When you visit the url to the ical feed: https://example.tld/civicrm?page=CiviCRM&q=civicrm%2Fevent%2Fical&reset=1
  you get the following .ics file
  civicrm_ical.ics
  BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
  X-WR-TIMEZONE:Europe/Amsterdam
  METHOD:PUBLISH
  BEGIN:VEVENT
  UID:CiviCRM_EventID_4_215ca88ba6fc880ae683205e6cd7bc8d@example.tld
  SUMMARY:Test-event
  DESCRIPTION:Some description
  CATEGORIES:ALV
  CALSCALE:GREGORIAN
  DTSTAMP;VALUE=DATE-TIME:20190401T200000
  DTSTART;VALUE=DATE-TIME:20190401T200000
  DTEND;VALUE=DATE-TIME:20190402T030000
  URL:https://example.tld/civicrm/?page=CiviCRM&q=civicrm%2Fevent%2Finfo&reset=1&id=4
  END:VEVENT
  END:VCALENDAR
  
  But when I use the url of the feed in fastmail or google calendar for instance, an error appears, or the calendar items do not appear. What could be the problem?
  I use CiviCRM 5.10.3 on Wordpress.
  Kind regards,
  Sam
  --- edit ---
  I got the following error message from Fastmail, my mailprovider.
  
  Syncing to your [redacted] calendar has been disabled: [ad2278bd-7237-4dee-884f-4eff6f3666bc] The calendar data was invalid: Error parsing VCalendar data: error Closed a different card name than opened at line 7 char 0:
  ---> ï»¿BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
  X-WR-TIMEZONE:Europe/Amsterdam
  METHOD:PUBLISH
  END:VCALENDAR
   <--- at /usr/lib/x86_64-linux-gnu/perl5/5.20/Text/VCardFast.pm line 55.
  
  BEGIN:VCALENDAR
  VERSION:2.0
  PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
  X-WR-TIMEZONE:Europe/Amsterdam
  METHOD:PUBLISH
  END:VCALENDAR
   at /home/mod_perl/hm/ME/CalDAVTalk.pm line 1427.
      ME::CalDAVTalk::_getEventsFromVCalendar(ME::CalDAV=HASH(0x8601578), "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"...) called at /home/mod_perl/hm/ME/CalDAVTalk.pm line 2554
      ME::CalDAVTalk::vcalendarToEvents(ME::CalDAV=HASH(0x8601578), "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"...) called at /home/mod_perl/hm/ME/CalDAV.pm line 1434
      eval {...} called at /home/mod_perl/hm/ME/CalDAV.pm line 1433
      ME::CalDAV::syncFromIcal(ME::CalDAV=HASH(0x8601578), "b8285308-2a18-4c47-9d22-fae8d8798d21", "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"..., HASH(0x89e5670), "Force", 0, "ReadUidPrefix", "913888i-") called at /home/mod_perl/hm/ME/CalDAV.pm line 1904
      eval {...} called at /home/mod_perl/hm/ME/CalDAV.pm line 1867
      ME::CalDAV::syncCalendar(ME::CalDAV=HASH(0x8601578), 913888, "Force", 0) called at /home/mod_perl/hm/scripts/caldav_sync.pl line 271
      main::SyncCalendar(ME::User=HASH(0x89bea78)) called at /home/mod_perl/hm/scripts/caldav_sync.pl line 98
  
  
  I have no idea what to make of this. There are currently no events in the calendar.
  
  **Tags:** wordpress, civievent, calendar
  
  > **Comments:**
  > **username_1**: For google, it might just be a delay. For example if you import the file, as a file import not a feed, you need to then close google calendar and reopen it to see the event. The feed maybe takes its own time. See here where it says "add using a link" https://support.google.com/calendar/answer/37100?hl=en&ref_topic=1672445. It says it might take 12 hours. When you say you get an error, what error do you get?  
  > **username_0**: i don't seem to get an error no more. but also after several days the calendar items are not loading. am i missing something obvious? what do you make of the ical-feed and its url, they're alright, right?  
  > **username_1**: It looks ok, and it does import into google as a file. A crazy workaround might be to set up the feed on your phone or somewhere where it does work, then set up that calendar to sync to the google calendar.  
  > **username_0**: I just got the error from Fastmail. Do you have an idea what to make of it?  
  > **username_0**: I got a response from Fastmail. The engineers there found out that the problem is the following:  "The problem is that your ics file begins with a UTF-8 Byte order mark or BOM — https://en.wikipedia.org/wiki/Byte_order_mark  Our server did not know what to do with this, but we've fixed it and now you should be all set.  I don't think it's typical to provide these in ics files, but we should have been able to handle it just the same."  So this seems to be an issue of CiviCRM, I opened an issue on their Gitlab: https://lab.civicrm.org/dev/wordpress/issues/25 .  
  > **username_1**: That usually happens when you have an extension or maybe even your civicrm.settings.php file that contains a BOM, so it gets output from there. Use the `grep` listed here (not the `find`) to see if there is one: https://stackoverflow.com/a/2858757/8332458  
  > **username_2**: See also https://civicrm.stackexchange.com/questions/30482/ical-feed-doesnt-work-lots-of-public-events-but-none-found ?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2019-05-31. Score: 0 | Accepted answer
  
  The issue has been solved with help I got on the civiCRM repo. (<https://lab.civicrm.org/dev/wordpress/issues/25>).
  
  1. First I found two files in my site that are loaded on every page that contain a BOM.
  
  `find . -type f -printf "%p " -a -exec od -x -N 4 \{\} \; | grep "bbef 3cbf"`
  
  2. Secondly I removed those BOMs with vim.
  
  Edit the files (which in my case where the `functions.php` and `header.php` file of my theme) with vim. Type `:set nobomb` and save the files.
  
  Now I can use the ical url of my site and it will load in virtual calendars.
  
  > **Comments:**
  > **username_1**: Ha ha you might not have noticed I'm the same person, the same way you have different usernames. No worries.  
  > **username_0**: Haha, thanks for your help!  
  
  ---
  
  ### Answer by username_1 on 2019-05-31. Score: 0
  
  As discussed in <https://lab.civicrm.org/dev/wordpress/issues/25> and using a different grep since the grep linked to in the comments above doesn't seem to work, there were two theme files with a BOM.
  
  This grep
  
  `find . -type f -printf "%p " -a -exec od -x -N 4 \{\} \; | grep "bbef 3cbf"`
  
  located
  
  `wp-content/themes/ari/functions.php
  wp-content/themes/ari/header.php`
  
  
  ---
  
  