From 7a4009601dbd33212aa8eb1b1c13ab9e8498b77b Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sun, 25 Oct 2020 00:12:00 +0200 Subject: [PATCH] Fixed newline escaping in YAML2SQL converter --- src/tool/yaml2sql.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tool/yaml2sql.cpp b/src/tool/yaml2sql.cpp index 4a52171027..62686cd258 100644 --- a/src/tool/yaml2sql.cpp +++ b/src/tool/yaml2sql.cpp @@ -236,6 +236,12 @@ std::string string_escape(const std::string &s) { escaped.reserve(n * 2); for (size_t i = 0; i < n; ++i) { + if (s[i] == '\r') + continue; + if (s[i] == '\n' && (i + 1) < n) { + escaped += "\\n"; + continue; + } if (s[i] == '\\' || s[i] == '\'') escaped += '\\'; escaped += s[i];