Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

End of Line Character

  • moot_systems
  • moot_systems's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 6 months ago #158616 by moot_systems
End of Line Character was created by moot_systems
Doing a download of survey responses to CSV, find that the end of line character is LF.

Have recently upgrade to 2.67.3 +170728 - on Linux

Previously I believe that end of line in the output CSV file was CR LF.

The issue with the change is that long responses themselves contain LF - so difficult to parse the files.
The topic has been locked.
More
6 years 4 months ago #160578 by orvil
Replied by orvil on topic End of Line Character
Hi,

I ran into the same problem - especially with long answers - and solved it by patching the according export routine.

You will find this one in \application\helpers\admin\export\CsvWriter.php

The very last function in this file (line 104ff) is
Code:
 
protected function csvEscape($value)
{
        return CSVEscape($value);
}

For my purposes I added as follows:
Code:
 
protected function csvEscape($value)
{
 
        $value = str_replace("\r\n", "; ", $value);  // cr & new line
        $value = str_replace("\n", "; ", $value);     // new line
        $value = str_replace("\r", "; ", $value);     // cr
 
        return CSVEscape($value);
}

You may like to add two slashes '//' in front of those of the 3 lines beginning with '$value=' you do not need.

Best regards/Beste Grüße,
O. Villani
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose