mstch/src/utils.cpp

14 lines
394 B
C++
Raw Normal View History

2015-04-09 18:41:27 +00:00
#include "utils.h"
2015-04-12 13:25:16 +00:00
#include <boost/algorithm/string/replace.hpp>
2015-04-09 18:41:27 +00:00
std::string mstch::html_escape(std::string str) {
2015-04-12 13:25:16 +00:00
boost::replace_all(str, "&", "&amp;");
boost::replace_all(str, "'", "&#39;");
boost::replace_all(str, "\"", "&quot;");
boost::replace_all(str, "<", "&lt;");
boost::replace_all(str, ">", "&gt;");
boost::replace_all(str, "/", "&#x2F;");
2015-04-09 18:41:27 +00:00
return str;
}