serializetoCSV

I am trying to save the grid as CSV so am doing some simple tests to transfer the data to the server for saving in a file:

_mygrid.enableCSVHeader(true);
var csvNew = _mygrid.serializeToCSV(); // serialize to CSV with the current active delimiter
wPopup = globalWindows.createWindow(“wPopup”, 20, 30, 500, 400);
wPopup.attachURL("/saveCVS?data=" + csvNew);

There doesn’t seem to be an EOL or CR character for each row so Excel imports it as one long line instead of multiple lines (one for each grid row). Is there a way to add this or do I have something configured wrong?

Thanks!

Figured it out - the newlines need to be URLencoded:

     csvNew = csvNew.replace(/(\r\n|\n|\r)/gm,"%0A");