Problem/Motivation

When exporting via Views Data Export as CSV with Strip HTML enabled, cell text is truncated if content contains plain-text < / > (e.g. low pressure, <1 MPa).

In CsvEncoder::formatValue() the order is:

  1. Html::decodeEntities($value)<1 MPa becomes <1 MPa
  2. strip_tags($value) — treats <... as a tag and removes/truncates the rest

Steps to reproduce

  1. Drupal 10.x, views_data_export, csv_serialization 4.0.1.
  2. Create content with HTML body text including e.g. low pressure, <1 MPa.
  3. Views display: Data export, format CSV, CSV settings: Strip HTML checked.
  4. Export and open CSV.

Proposed resolution

Swap order in formatValue():

if ($this->stripTags) {
  $value = strip_tags($value);
  $value = Html::decodeEntities($value);
}

Strip real HTML tags first, then decode entities so plain </> are preserved.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gtriant created an issue.

ishani patel made their first commit to this issue’s fork.