Inconsistent handling of newlines (\n) in description

Created on 26 September 2022, almost 2 years ago
Updated 10 March 2023, over 1 year ago

Problem/Motivation

The Google addtocal formatter and the "Generic" formatter handle newlines differently, at least for the description field. A newline in the description for Google does get rendered properly by Google, but the same thing breaks things for Outlook (Outlook won't interpret any variables after it hits the newline). Outlook is happy if the newline gets escaped, but when that's done Google will display the extra backslashes and won't interpret it as a newline. We should pick whether newlines should be escaped or not in the description, and then ensure they're encoded such that they're handled consistently by clients.

This is only really an issue when implementing hook_addtocal_alter() because otherwise newlines are already stripped by \Drupal\addtocal\AddToCalTypeBase::extractFieldValue (which I suspect is done to sidestep this issue and is a pretty unappealing solution since stripping all newlines can lead to pretty unreadable text, so maybe that should be un-done there once this is fixed).

We're using 1.x so we're not sure if this is an issue with 2.x.

Steps to reproduce

In hook_addtocal_alter() modify the $overridable_items['description'] like so:

$overridable_items['description'] = "First line\nSecond line";

Observe that this is output on 2 lines correctly in Google, but breaks Outlook.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States azinck

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024