aboutsummaryrefslogtreecommitdiff
path: root/source/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/utils.cpp')
-rw-r--r--source/utils.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/utils.cpp b/source/utils.cpp
index abeab27b..0ee7cfaf 100644
--- a/source/utils.cpp
+++ b/source/utils.cpp
@@ -64,3 +64,23 @@ void log(const QByteArray& str)
{
QXmppLogger::getLogger()->log(str);
}
+
+QString escapeString(const QString& str)
+{
+ QString strOut = str;
+ strOut.replace(QChar('&'), "&");
+ strOut.replace(QChar('<'), "&lt;");
+ strOut.replace(QChar('>'), "&gt;");
+ strOut.replace(QChar('"'), "&quot;");
+ return strOut;
+}
+
+QString unescapeString(const QString& str)
+{
+ QString strOut = str;
+ strOut.replace("&lt;", QChar('<'));
+ strOut.replace("&gt;", QChar('>'));
+ strOut.replace("&quot;", QChar('"'));
+ strOut.replace("&amp;", QChar('&'));
+ return strOut;
+}