HTML tags are not rendered in iCal readers.
Please remove html tags from the ical feed by using PHP strip_tags

its already in the code but is currently commented out

CommentFileSizeAuthor
#8 diff.patch766 byteshawleyal
DATE-ical-strip-tags.patch506 bytesmarkDrupal
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kaare’s picture

I resolved this by running html_to_text() in the theme layer for those fields. This might be an idea (in date module) for whatever field you use as event description in your ical feed. If you in addition replace newlines with \n (This didn't work during theming as "\n" would be spit out as "\\n") the output would become as purty as it gets for ICAL feeds.

KarenS’s picture

Status: Needs review » Postponed (maintainer needs more info)

I am not sure that there is anything in the standard that says html cannot be in an ical feed. That's why it is commented out. If you can point to something in the standard that says html is not allowed or expected I'll commit this, otherwise I'm not sure about it.

markDrupal’s picture

It's not clear but the Ical spec says that the description is only human readable text and the only characters that should be escaped are "\\" / "\;" / "\," / "\N" / "\n"

So I could argue that a "<b>THIS</b>" should display as a human readable "<b>THIS</b>" and not "THIS". Since the < > characters are no longer human readable, it could be breaking the spec.

What do you think?

4.3.11 Text

Value Name: TEXT

Purpose This value type is used to identify values that contain human
readable text.

Formal Definition: The character sets supported by this revision of
iCalendar are UTF-8 and US ASCII thereof. The applicability to other
character sets is for future work. The value type is defined by the
following notation.

text = *(TSAFE-CHAR / ":" / DQUOTE / ESCAPED-CHAR)
; Folded according to description above

ESCAPED-CHAR = "\\" / "\;" / "\," / "\N" / "\n")
; \\ encodes \, \N or \n encodes newline
; \; encodes ;, \, encodes ,

.....
....

4.8.1.5 Description

Property Name: DESCRIPTION

Purpose: This property provides a more complete description of the
calendar component, than that provided by the "SUMMARY" property.

Value Type: TEXT

markDrupal’s picture

Status: Postponed (maintainer needs more info) » Needs review
markDrupal’s picture

Its been about a month since I posted details about the iCal specs.
I'm adding this comment in case you missed it before.

Any comments about the iCal specs in regards to html tags?

markDrupal’s picture

It's been 2 months since you asked your question. I provided the additional data as you requested, could you follow up with additional requirements or comments?

klucid’s picture

Regardless of your debate, I needed this option for Microsoft Outlook. I was using a field to export as the description in an Outlook "Appointment", but since Outlook Appointments are not HTML format, the HTML tags were showing.

This patch fixed the issue.

Thanks to both of your for your continued support on Drupal.

hawleyal’s picture

Issue tags: +patch, +html, +description, +markup, +text, +ical, +plain
FileSize
766 bytes

This patch outputs human readable format the way Drupal intended.

Imports correctly in Google Calendar and Outlook.

Instead of:

$text = strip_tags($text); // strip tags, doesn't add line breaks.

Do:

$text = drupal_html_to_text($text); // convert html, add line breaks, et al.
$text = trim($text); // strip last line break

This line was broken, caused invalid iCal format:

$text = str_replace("\n", "\n ", $text); // add space after newline

Replace with this line:

$text = str_replace("\n", "\\n ", $text); // hardcode newline code, add space
KarenS’s picture

Status: Needs review » Fixed

Trying to figure out if it should be $text = str_replace("\n", "\\n ", $text); or $text = str_replace("\n", "\r\n ", $text); as suggested in #675352: tweaks for date_ical_escape_text to make it closer to ical spec conformance. I overwrote that patch with this one, but I don't know which better. If anyone knows, please tell me :(

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.