src/system/helpers.cpp: Add htmlEntityDecode() for decode html string

Origin commit data
------------------
Branch: ni/coolstream
Commit: 0028ad0d9b
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-02-26 (Wed, 26 Feb 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-02-26 10:02:32 +01:00
parent 710f57bc83
commit 04530b5968
2 changed files with 23 additions and 0 deletions

View File

@@ -417,6 +417,28 @@ std::string& str_replace(const std::string &search, const std::string &replace,
return text;
}
std::string& htmlEntityDecode(std::string& text)
{
struct decode_table {
const char* code;
const char* htmlCode;
};
decode_table dt[] =
{
{" ", "&nbsp;"},
{"&", "&amp;"},
{"<", "&lt;"},
{">", "&gt;"},
{"\"", "&quot;"},
{"'", "&apos;"},
{NULL, NULL}
};
for (int i = 0; dt[i].code != NULL; i++)
text = str_replace(dt[i].htmlCode, dt[i].code, text);
return text;
}
CFileHelpers::CFileHelpers()
{
FileBufSize = 0xFFFF;