End files with a newline

Created on 22 May 2024, 9 months ago

Problem/Motivation

Exported files do not end in a newline character.

Proposed resolution

Add a newline at the end of each export file.

Remaining tasks

Implement.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Liam Morland
  • 🇬🇧United Kingdom steven jones

    Thanks for the bug report, were there specific export types that exhibit this issue, or is it all of the text based ones?

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    I think I was only trying text formats, likely just CSV.

  • 🇬🇧United Kingdom steven jones

    @Liam Morland should CSVs end with a newline character?

    I've seen arguments for and against adding a newline character to the end of a row, making me think this should be a feature, not a bug? Do you have an example of why we'd want to add a newline character to the last row?

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    Ending every line with newline is a requirement of POSIX. The definition of a line is "A sequence of zero or more non- characters plus a terminating character." So, unless the file contains zero lines, it will end in a newline.

  • 🇬🇧United Kingdom steven jones

    And yet if you do a Google search you'll find plenty of people asking to remove the 'blank' line from the end of their CSV.

    I suspect it would be highly dependant on the reader of the CSV if a new line was needed at the end.

    I'll mark this as a feature request, and do please add details of a CSV reading library that fails to read a CSV file if there's no newline character at the end of the file, thanks!

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    I don't recall the problem that I was facing last May, just that I had traced it to the missing newlines.

    POSIX says they should be there. Is there any standard that says they should not be there?

    If a CSV library does not work properly when the newline is there, that sounds like a bug in the library.

Production build 0.71.5 2024