I have a CSV export which is done by the "views_data_export" module. When exporting, a plain text field which contains a double quote ends up with a " HTML entitity in the CSV file. This doesn't make sense, and when Im importing this file, this leads to problems.
I'm actually working with Drupal 9.5.10 and different entities, but was able to reproduce this with a fresh Drupal 10.1 installation. I hope I didn't forget any important step in the description.
Steps to reproduce
- Install Drupal 10.1 (10.1.3-dev)
- Install the modules "drupal/views" and "drupal/views_data_export"
- Create an Article node and set the title as >>Test "Hello" Test<<
- Create a view "article export" and set the following:
- Add a display of type "data export"
- Set the content type filter to match Article nodes
- Under Format > Settings choose "csv". Expand the "CSV Settings" section and uncheck "Strip HTML".
- Make sure the "title" field is selected and the formatter is set to "Plain text". Uncheck "Link to the content".
- Set the path and the filename to "all_articles.csv"
- Save the view and call the path
Expected
A CSV file with this content:
title
"Test ""Hello"" Test"
Actual
A CSV file with this content:
title
"Test "Hello" Test"
Any ideas on how to get the HTML out of there? Simply activating "Strip HTML" is not good enough, since the real-world example also contains fields which are supposed to contain HTML. The export is coupled with an import, so that users can modify the CSV file and reimport it. So the HTML fields need to contai HTML and the other fields should not contain HTML.