always properly escape double quotes

This commit is contained in:
Max Ogden
2011-06-15 20:31:29 -07:00
parent f10cfd9acf
commit 25db477531

View File

@@ -19,8 +19,8 @@ function(head, req) {
if (row.value[headers[header]]) { if (row.value[headers[header]]) {
if (startedOutput) send(","); if (startedOutput) send(",");
var value = row.value[headers[header]]; var value = row.value[headers[header]];
if (typeof(value) == "object") value = JSON.stringify(value).replace(/\"/g, '""'); if (typeof(value) == "object") value = JSON.stringify(value);
send("\"" + value + "\""); send("\"" + value.replace(/\"/g, '""') + "\"");
} else { } else {
if (startedOutput) send(","); if (startedOutput) send(",");
} }