End of Line Character

More
4 months 2 days ago #158616 by moot_systems
moot_systems created the topic: End of Line Character
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.

Please Log in to join the conversation.

More
2 months 3 days ago #160578 by orvil
orvil replied the 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
 
protected function csvEscape($value)
{
        return CSVEscape($value);
}

For my purposes I added as follows:
 
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

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!