Change to enclose field values ​​with quotation character in exported CSV file if they contain delimiters in Spreadsheet workbench (#17140)

* Change to enclose field values ​​with quotation character in exported CSV file if they contain delimiters

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
H. Tsubota
2024-10-15 00:52:38 +09:00
committed by GitHub
parent e9bbc75f60
commit 684091aa01

View File

@@ -342,7 +342,8 @@ bool Sheet::exportToFile(const std::string& filename,
std::string str = field.str();
if (quoteChar && str.find(quoteChar) != std::string::npos) {
if (quoteChar
&& str.find_first_of(std::string(quoteChar, delimiter)) != std::string::npos) {
writeEscaped(str, quoteChar, escapeChar, file);
}
else {