Merge pull request #1261 from laanwj/2012_05_escapecsv

Properly escape strings when exporting CSV
This commit is contained in:
Wladimir J. van der Laan 2012-05-11 23:30:04 -07:00
commit 661834d02b
1 changed files with 3 additions and 2 deletions

View File

@ -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)