escape string while exporting to csv

This commit is contained in:
Nabin Hait 2013-01-02 15:02:08 +05:30
parent 09e2d37f78
commit 2ac788bf48

View file

@ -34,7 +34,7 @@ wn.to_csv = function(data) {
var res = [];
$.each(data, function(i, row) {
row = $.map(row, function(col) {
return typeof(col)==="string" ? ('"' + col.replace(/"/g, '\"') + '"') : col;
return typeof(col)==="string" ? ('"' + col.replace(/"/g, '""') + '"') : col;
});
res.push(row.join(","));
});