瀏覽代碼

updating text escape to cover double quotes and single quotes better

logicp 5 年之前
父節點
當前提交
8883438cfa
共有 1 個文件被更改,包括 4 次插入1 次删除
  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;
 }