Exposed escapeForJSON() in kiwix namespace

Note that it is declared in stringTools.h but its definition remains in
otherTools.cpp (to minimize the diff).
This commit is contained in:
Veloman Yunkan 2024-01-09 20:58:44 +04:00
parent 1553d52593
commit f3d3ab13cb
2 changed files with 5 additions and 4 deletions

View File

@ -327,10 +327,7 @@ std::string kiwix::render_template(const std::string& template_str, kainjow::mus
return ss.str();
}
namespace
{
std::string escapeForJSON(const std::string& s)
std::string kiwix::escapeForJSON(const std::string& s)
{
std::ostringstream oss;
for (char c : s) {
@ -345,6 +342,9 @@ std::string escapeForJSON(const std::string& s)
return oss.str();
}
namespace
{
std::string makeFulltextSearchSuggestion(const std::string& lang,
const std::string& queryString)
{

View File

@ -53,6 +53,7 @@ private:
const icu::Locale locale;
};
std::string escapeForJSON(const std::string& s);
/* urlEncode() is the equivalent of JS encodeURIComponent(), with the only
* difference that the slash (/) symbol is NOT encoded. */