Import: do not remove characters from CSV header fields

This is as described in RFC-4180. See issue #2445.
This commit is contained in:
mgrojo
2021-02-26 22:09:47 +01:00
parent efa1cdf273
commit 248a630dd1
+1 -7
View File
@@ -401,14 +401,8 @@ sqlb::FieldVector ImportCsvDialog::generateFieldList(const QString& filename) co
// If the user wants to use the first row as table header and if this is the first row, extract a field name
if(rowNum == 0 && ui->checkboxHeader->isChecked())
{
// Take field name from CSV and remove invalid characters
// Take field name from CSV
fieldname = std::string(rowData.fields[i].data, rowData.fields[i].data_length);
fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), '`'), fieldname.end());
fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), ' '), fieldname.end());
fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), '"'), fieldname.end());
fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), '\''), fieldname.end());
fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), ','), fieldname.end());
fieldname.erase(std::remove(fieldname.begin(), fieldname.end(), ';'), fieldname.end());
}
// If we don't have a field name by now, generate one