aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-05-11 20:17:09 +0200
committerLuke Dashjr <luke-jr+git@utopios.org>2012-05-15 08:03:38 +0000
commitdc15d56b2df25f5ea2e4d1d9b16a3f6578524035 (patch)
tree2aa0de0695b0fd134079d70a521086edded3bd11
parent7515f00aa36e5650aaca5db911e80536514678be (diff)
Properly escape " in strings when exporting CSV
-rw-r--r--src/qt/csvmodelwriter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qt/csvmodelwriter.cpp b/src/qt/csvmodelwriter.cpp
index 84578b3322..8a50bbab3f 100644
--- a/src/qt/csvmodelwriter.cpp
+++ b/src/qt/csvmodelwriter.cpp
@@ -27,8 +27,9 @@ void CSVModelWriter::addColumn(const QString &title, int column, int role)
static void writeValue(QTextStream &f, const QString &value)
{
- // TODO: quoting if " or \n in string
- f << "\"" << value << "\"";
+ QString escaped = value;
+ escaped.replace('"', "\"\"");
+ f << "\"" << escaped << "\"";
}
static void writeSep(QTextStream &f)