mstch/src/utils.cpp
2015-04-15 01:42:51 +02:00

13 lines
396 B
C++

#include "utils.hpp"
#include <boost/algorithm/string/replace.hpp>
std::string mstch::html_escape(std::string str) {
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;");
return str;
}