Opened 5 years ago

Closed 5 years ago

#609 closed Bug (fixed)

Misaligned data when exported in CSV

Reported by: ldhingra Owned by:
Priority: major Milestone: RobotRock
Component: Core Keywords: csv
Cc: Sensitive:


I am downloading data from piwik using API and in csv format.
However, at certain places, e.g. row 42, 56, 66 in attached file, the data is shifted to undesired columns stopping me from processing.

Attachments (1)

20piwik-report-export.csv (9.4 KB) - added by ldhingra 5 years ago.
CSV File

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by ldhingra

CSV File

comment:1 Changed 5 years ago by ldhingra

Sorry, my bad.
The data set contains commas, reason enough for misalignment.

comment:2 Changed 5 years ago by vipsoft (robocoder)

  • Milestone set to DigitalVibes

This is one of the better write ups on the CSV pseudo-standard:

Proposed changes to /core/DataTable/Renderer/Csv.php:

  • escape double quotes (" becomes "")
  • wrap any field with double quotes if it contains comma or double quotes

Proposed test cases added to /tests/core/DataTable/Renderer.test.php:

  • field with no double quotes or commas
  • field with comma
  • field with double quotes
  • field with commas and double quotes

comment:3 Changed 5 years ago by matt (mattab)

  • Milestone changed from DigitalVibes to RobotRock

comment:4 Changed 5 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [1008]) - fixed #609 Misaligned data when exported in CSV
thanks vipsoft for your pre-analysis and suggestions

Note: See TracTickets for help on using tickets.