Browse Source

Properly escape " in strings when exporting CSV

pull/1/head
Wladimir J. van der Laan 11 years ago
parent
commit
875f71d4ef
  1. 5
      src/qt/csvmodelwriter.cpp

5
src/qt/csvmodelwriter.cpp

@ -27,8 +27,9 @@ void CSVModelWriter::addColumn(const QString &title, int column, int role) @@ -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)

Loading…
Cancel
Save