From 045e3a5c95f561d250172cc96bda9ed79470bab5 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Fri, 27 Mar 2026 07:59:07 -0400 Subject: [PATCH] Add newlines to list of special CSV chars for quoting. --- finnow-api/source/util/csv.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finnow-api/source/util/csv.d b/finnow-api/source/util/csv.d index 385d613..24adb31 100644 --- a/finnow-api/source/util/csv.d +++ b/finnow-api/source/util/csv.d @@ -30,7 +30,9 @@ struct CsvStreamWriter(S) if (isByteOutputStream!S) { import std.regex : replaceAll, regex; import std.string : indexOf; string s = value.to!string(); - bool shouldValueBeQuoted = indexOf(s, '"') != -1 || indexOf(s, ',') != -1; + bool shouldValueBeQuoted = indexOf(s, '"') != -1 || + indexOf(s, ',') != -1 || + indexOf(s, '\n') != -1; s = replaceAll(value.to!string(), regex("\""), "\"\""); if (shouldValueBeQuoted) { s = "\"" ~ s ~ "\"";