diff options
author | llnulldisk <48621230+llnulldisk@users.noreply.github.com> | 2022-10-05 13:57:24 +0200 |
---|---|---|
committer | llnulldisk <48621230+llnulldisk@users.noreply.github.com> | 2022-10-05 13:57:24 +0200 |
commit | 1d238b70e2655e64b1cb1a51357a9eb0c753181d (patch) | |
tree | 225887e2662598a15ce2a98f1ca5ea0a146cd516 /src/tools | |
parent | d9615bbe41c830eb3941e3f6235d47b6a46e584d (diff) |
Escape poll options (#128)
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/StringTools.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/StringTools.cpp b/src/tools/StringTools.cpp index 653047c..3e5e6c4 100644 --- a/src/tools/StringTools.cpp +++ b/src/tools/StringTools.cpp @@ -101,4 +101,22 @@ string urlDecode(const string& value) { return result; } +std::string escapeJsonString(const std::string& value) { + string result; + + for (const char& c : value) { + switch (c) { + case '"': + case '\\': + case '/': + result += '\\'; + break; + } + + result += c; + } + + return result; +} + } |