Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#8 | diff.patch | 766 bytes | hawleyal |
DATE-ical-strip-tags.patch | 506 bytes | markDrupal | |
Comments
Comment #1
kaareI 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.Comment #2
KarenS CreditAttribution: KarenS commentedI 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.
Comment #3
markDrupal CreditAttribution: markDrupal commentedIt'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
Comment #4
markDrupal CreditAttribution: markDrupal commentedComment #5
markDrupal CreditAttribution: markDrupal commentedIts 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?
Comment #6
markDrupal CreditAttribution: markDrupal commentedIt'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?
Comment #7
klucid CreditAttribution: klucid commentedRegardless 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.
Comment #8
hawleyal CreditAttribution: hawleyal commentedThis patch outputs human readable format the way Drupal intended.
Imports correctly in Google Calendar and Outlook.
Instead of:
Do:
This line was broken, caused invalid iCal format:
Replace with this line:
Comment #9
KarenS CreditAttribution: KarenS commentedTrying 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 :(