Selaa lähdekoodia

finally got quotes working

logicp 5 vuotta sitten
vanhempi
commit
a9f45d2641
1 muutettua tiedostoa jossa 8 lisäystä ja 4 poistoa
  1. 8 4
      headers/util.hpp

+ 8 - 4
headers/util.hpp

@@ -58,13 +58,17 @@ struct KSession {
 
 static QString escapeText(QString s) {
     qDebug() << "Escaping text";
-    if (s.contains("'")) {
-        qDebug() << "Replacing single quote";
-        s.replace("'", "\'");
-    }
     if (s.contains("\t")) {
         s.replace("\t", "\\t");
     }
+    if (s.contains("'")) {
+        qDebug() << "Replacing single quote";
+        if (s.contains('"')) {
+            s.replace('"', "\\\"");
+        }
+        s.replace("'", "'\"\'\"'");
+        return s;
+    }
     if (s.contains('"')) {
         s.replace('"', "\\\"");
     }