cxxrtl, fmt: escape double quotes in c strings

This commit is contained in:
Robin Ole Heinemann
2024-11-11 18:49:05 +00:00
committed by Catherine
parent 7cfc49791f
commit 8bc4bd8a20
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -612,7 +612,7 @@ std::string escape_c_string(const std::string &input)
output.push_back('"');
for (auto c : input) {
if (::isprint(c)) {
if (c == '\\')
if (c == '\\' || c == '"')
output.push_back('\\');
output.push_back(c);
} else {
+1 -1
View File
@@ -630,7 +630,7 @@ std::string escape_cxx_string(const std::string &input)
std::string output = "\"";
for (auto c : input) {
if (::isprint(c)) {
if (c == '\\')
if (c == '\\' || c == '"')
output.push_back('\\');
output.push_back(c);
} else {