소스 검색

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;
 }