Explorar o código

updating text escape to cover double quotes and single quotes better

logicp %!s(int64=5) %!d(string=hai) anos
pai
achega
8883438cfa
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      headers/util.hpp

+ 4 - 1
headers/util.hpp

@@ -1,6 +1,6 @@
 #ifndef UTIL_HPP
 #define UTIL_HPP
-
+#pragma GCC system_header
 #include <string>
 #include <charconv>
 #include <utility>
@@ -65,6 +65,9 @@ static QString escapeText(QString s) {
     if (s.contains("\t")) {
         s.replace("\t", "\\t");
     }
+    if (s.contains('"')) {
+        s.replace('"', "\\\"");
+    }
     return s;
 }