View Issue Details

This bug affects 1 person(s).
 18
IDProjectCategoryView StatusLast Update
18318Bug reportsImport/Exportpublic2023-06-20 17:49
ReporterJmantysalo Assigned Toollehar  
PrioritynormalSeveritytrivial 
Status closedResolutionreopened 
Product Version5.3.x 
Summary18318: Empty line at the end of csv export
Description

CSV-export of responses contains an empty line at the end. (And yes, I noticed this when trying an automatic processing of the file.)

.lsa attached for testing.

TagsNo tags attached.
Attached Files
Bug heat18
Complete LimeSurvey version number (& build)5.3.32+220817
I will donate to the project if issue is resolvedNo
Browser
Database type & versionN/A
Server OS (if known)
Webserver software & version (if known)
PHP VersionN/A

Users monitoring this issue

c_schmitz, f_funke

Activities

gabrieljenik

gabrieljenik

2023-01-30 12:50

manager   ~73599

That empty line at end of line seems was addes on purpose by @c_schmitz here to enhance excel compatibility
https://github.com/LimeSurvey/LimeSurvey/commit/1174354b35d7b0480f66dde23be6da08bc0366d9

I believe it is better to not remove them.
Of course, feel free to reopen it if you feel this should be further explored.

Thanks

c_schmitz

c_schmitz

2023-01-30 12:59

administrator   ~73600

@gabrieljenik

Not exactly true. I did not add that line.
I think the line can be removed, but need to test with R, because according to the comments it is the only reason it exists "for R compatibility".

gabrieljenik

gabrieljenik

2023-01-30 13:04

manager   ~73601

Oops, my bad... I was saying that following the commit message :)

Who can test with R?

c_schmitz

c_schmitz

2023-02-06 20:38

administrator   ~73711

@f_funke ?

f_funke

f_funke

2023-02-09 15:17

developer   ~73781

I see that empty line in the data file. But when importing the data in R this has no effect. The empty lines doe not result in a separate (empty) cases. However, removing the empty line makes no difference for the import in R.

To be honest, I don't understand the problem of the empty line. The empty line inflates the file size by 4 bytes - bytes, not kB or mB ;-)

Could @Jmantysalo please add more information about the relevance?

Jmantysalo

Jmantysalo

2023-02-09 21:54

reporter   ~73784

Could @Jmantysalo please add more information about the relevance?

I noticed this when doing some automatic prosessing (can't remember what exactly). I wrote a small code assuming that every line of the file contains a response. Of course I can start my script with 'egrep .' or 'tac | tail -n +2 | tac' now when I know this. Hence I reported this, but put "trivial" as severity. No hard feelings if this will be closed without fix.

jelo

jelo

2023-02-20 13:26

partner   ~73884

The empty line might was added to have an separator when importing multiple CSV into one data table.
If it was a workaround for an old issue in R it will be hard to track back.
The mess around CR and LF on different platforms come to my mind.
Windows uses CR and LF characters to terminate lines. Unix,Linux,OSX only LF. The old Mac used CR.

c_schmitz

c_schmitz

2023-02-20 17:23

administrator   ~73889

OK, then we can remove that line.

gabrieljenik

gabrieljenik

2023-02-24 18:49

manager   ~73951

https://github.com/LimeSurvey/LimeSurvey/pull/2942

DenisChenu

DenisChenu

2023-02-25 17:32

developer   ~73952

To be honest, I don't understand the problem of the empty line. The empty line inflates the file size by 4 bytes - bytes, not kB or mB ;-)

A lot of import system broke with empty line. For example : export with EM code : you get a file near a VV file.
Import it as VV (set first line) : you have an empty response.

gabrieljenik

gabrieljenik

2023-03-01 14:20

manager   ~73998

Is this as expected?

image.png (19,540 bytes)   
image.png (19,540 bytes)   
gabrieljenik

gabrieljenik

2023-03-09 15:34

manager   ~74076

@Jmantysalo can you confirm the picture above is as expected?

Thanks!

Jmantysalo

Jmantysalo

2023-03-10 13:17

reporter   ~74084

can you confirm the picture above is as expected?

I think so. The editor probably shows line number 4, even when line 4 has no content.

gabrieljenik

gabrieljenik

2023-03-10 19:12

manager   ~74092

@Jmantysalo Can you test with R?

Jmantysalo

Jmantysalo

2023-03-13 09:00

reporter   ~74093

Tested and yes, it worked. (I.e. after source("survey_123456_R_syntax_file.R") everything seems fine with str(data) -command.)

gabrieljenik

gabrieljenik

2023-03-13 15:01

manager   ~74100

Tested by @Jmantysalo

guest

guest

2023-03-20 12:38

viewer   ~74210

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=34381

Related Changesets

LimeSurvey: master caad58d5

2023-03-20 12:24:57

Gabriel Jenik


Committer: GitHub Details Diff
Fixed issue 18318: Empty line at the end of csv export (#2942)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
18318
mod - application/helpers/admin/export/CsvWriter.php Diff File

Issue History

Date Modified Username Field Change
2022-08-18 12:32 Jmantysalo New Issue
2022-08-18 12:32 Jmantysalo File Added: survey_archive_923716.lsa
2022-08-22 11:55 ollehar Priority none => normal
2023-01-19 13:52 gabrieljenik Status new => acknowledged
2023-01-24 20:30 gabrieljenik Assigned To => gabrieljenik
2023-01-24 20:30 gabrieljenik Status acknowledged => assigned
2023-01-30 12:50 gabrieljenik Assigned To gabrieljenik =>
2023-01-30 12:50 gabrieljenik Status assigned => closed
2023-01-30 12:50 gabrieljenik Resolution open => no change required
2023-01-30 12:50 gabrieljenik Note Added: 73599
2023-01-30 12:50 gabrieljenik Bug heat 0 => 2
2023-01-30 12:59 c_schmitz Note Added: 73600
2023-01-30 12:59 c_schmitz Bug heat 2 => 4
2023-01-30 13:00 c_schmitz Assigned To => c_schmitz
2023-01-30 13:00 c_schmitz Status closed => feedback
2023-01-30 13:00 c_schmitz Resolution no change required => reopened
2023-01-30 13:04 gabrieljenik Note Added: 73601
2023-02-06 20:38 c_schmitz Note Added: 73711
2023-02-09 13:38 c_schmitz Assigned To c_schmitz => f_funke
2023-02-09 13:38 c_schmitz Issue Monitored: c_schmitz
2023-02-09 13:38 c_schmitz Bug heat 4 => 6
2023-02-09 15:17 f_funke Note Added: 73781
2023-02-09 15:17 f_funke Bug heat 6 => 8
2023-02-09 15:50 f_funke Issue Monitored: f_funke
2023-02-09 15:50 f_funke Bug heat 8 => 10
2023-02-09 21:54 Jmantysalo Note Added: 73784
2023-02-09 21:54 Jmantysalo Bug heat 10 => 12
2023-02-09 21:54 Jmantysalo Status feedback => assigned
2023-02-20 13:26 jelo Note Added: 73884
2023-02-20 13:26 jelo Bug heat 12 => 14
2023-02-20 17:23 c_schmitz Note Added: 73889
2023-02-24 18:49 gabrieljenik Assigned To f_funke => DenisChenu
2023-02-24 18:49 gabrieljenik Status assigned => ready for code review
2023-02-24 18:49 gabrieljenik Note Added: 73951
2023-02-25 17:32 DenisChenu Note Added: 73952
2023-02-25 17:32 DenisChenu Bug heat 14 => 16
2023-02-25 17:32 DenisChenu Assigned To DenisChenu =>
2023-02-25 17:32 DenisChenu Status ready for code review => ready for testing
2023-03-01 14:20 gabrieljenik Note Added: 73998
2023-03-01 14:20 gabrieljenik File Added: image.png
2023-03-09 15:34 gabrieljenik Note Added: 74076
2023-03-10 13:17 Jmantysalo Note Added: 74084
2023-03-10 19:12 gabrieljenik Note Added: 74092
2023-03-13 09:00 Jmantysalo Note Added: 74093
2023-03-13 15:01 gabrieljenik Assigned To => ollehar
2023-03-13 15:01 gabrieljenik Status ready for testing => ready for merge
2023-03-13 15:01 gabrieljenik Note Added: 74100
2023-03-20 12:38 Changeset attached => LimeSurvey master caad58d5
2023-03-20 12:38 guest Note Added: 74210
2023-03-20 12:38 guest Bug heat 16 => 18
2023-03-20 12:58 ollehar Status ready for merge => resolved
2023-06-20 17:49 c_schmitz Status resolved => closed