Bug 34705 - Koha should use a CSV library to generate CSV
Summary: Koha should use a CSV library to generate CSV
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-04 12:54 UTC by Tomás Cohen Arazi
Modified: 2023-09-05 23:58 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2023-09-04 12:54:42 UTC
Generating CSV using a template and concatenating string using separators doesn't always generate valid CSV, and should be a avoided. The Koha codebase shouldn't contain code to deal with special escape sequences or CSV generation internals. We already include Text::CSV_XS and should just pass it arrayrefs for each row, and let the library deal with CSV complexities [1].

This was highlighted by bug 34043.

[1] https://en.wikipedia.org/wiki/Comma-separated_values#Basic_rules
Comment 1 David Cook 2023-09-04 23:18:24 UTC
+1000