Just a quick question before I start developing my own solution while it is maybe already part of POCO (A donkey does not bump into the same stone twice, they say in Dutch).
Is there a way to encode &, <, >, ... for HTML?
Franky
std::string htmlize(const std::string& str)
{
std::string::const_iterator it(str.begin());
std::string::const_iterator end(str.end());
std::string html;
for (; it != end; ++it)
{
switch (*it)
{
case '<': html += "<"; break;
case '>': html += ">"; break;
case '"': html += """; break;
case '&': html += "&"; break;
default: html += *it; break;
}
}
return html;
}Users browsing this forum: guenter and 0 guests