Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV Exporting not escaping some character properly #9958

Closed
playcraftSystems opened this issue Oct 12, 2021 · 4 comments
Closed

CSV Exporting not escaping some character properly #9958

playcraftSystems opened this issue Oct 12, 2021 · 4 comments
Labels

Comments

@playcraftSystems
Copy link

Description

The Craft CMS CSV export is not displaying properly in Excel / Google Sheets. Exporting entries, either expanded or raw, tab, semicolon, or comma separated, throws data into columns where it does not belong. The biggest offender is Seomatic data. First reported here nystudio107/craft-seomatic#999.

Steps to reproduce

  1. Use Seomatic plugin
  2. Go to entries and export CSV
  3. Open CSV in Google Sheets or Excel

Additional info

  • Craft version: Craft Pro 3.7.16
  • PHP version: 8.0.11
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions:
  • Seomatic 3.4.15
  • Asset Rev 6.0.2
  • Control Panel 2.4.0
  • Element API 2.8.3
  • Embedded Assets 2.8.1
  • Entry Instructions 1.0.7
  • Feed Me 4.4.0
  • Field Manager 2.2.4
  • Freeform 3.11.11.1
  • ImageOptimize 1.6.36
  • Image Resizer 2.1.0
  • Internal Assets 2.3.2
  • Linkit 1.1.12.1
  • Matrix Toolbar 1.0.6
  • Neo 2.11.14
  • Position Fieldtype 1.0.17
  • Redactor 2.8.8
  • Relabel 2.0.2
  • Retour 3.1.61
  • Spoon 3.6.1
  • Super Table 2.6.8
  • Wordsmith 3.3.0.1
  • Amazon S3 1.2.15
  • Command Palette 3.1.4
@brandonkelly
Copy link
Member

Thanks for reporting that! Just got it fixed for the next release.

To get the fix early, change your craftcms/cms requirement in composer.json to "dev-develop as 3.7.16" and run composer update.

@brandonkelly
Copy link
Member

Craft 3.7.17 is out now with that fix.

@owldesign
Copy link

owldesign commented Oct 21, 2021

I'm on version 3.7.17 an when I try to export to CSV I get this error:

"name" => "PHP Warning"
"message" => "fputcsv(): escape must be a character"

Note v 3.7.16 worked when the public $escapeChar = ''; was set to public $escapeChar = '\\';

Can we just remove last argument $this->escapeChar from bellow? Or somehow get access to override the $escapeChar variable?

fputcsv($fp, $row, $this->delimiter, $this->enclosure, $this->escapeChar);

@brandonkelly
Copy link
Member

@owldesign Whoops, looks like the fix relies on a change in PHP 7.4. Just fixed for 7.2 / 7.3, however the original bug will remain on those versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants