I am trying to create a CSV file from my web page and am having issue with line feeds/carraige returns.
I am building up the CSV string via Javascript and then adding '\u000A' + "\u000D" to the end of each line.
I then pass my CSV sting to a PHP program via AJAX. My PHP logic to create the file is: -
header('Content-Disposition: attachment; filename="effortTool.csv"');
header('Content-Type: text/plain');
header('Content-Length: ' . strlen($content));
When I view the file it does not contain any line feeds/carraige retuns.
If I output the CSV string as an "alert", I can see it is formatting corerctly. This tells me that the line feeds characters are being added but are being lost when downloaded as a file.
Any ideas?
Thanks
Martin