diff --git a/nel/include/nel/gui/html_element.h b/nel/include/nel/gui/html_element.h
index 9a26938af..034bbccbf 100644
--- a/nel/include/nel/gui/html_element.h
+++ b/nel/include/nel/gui/html_element.h
@@ -79,13 +79,13 @@ namespace NLGUI
std::string htmlEscape(const std::string &val) const;
// serialize element attributes as string
- std::string serializeAttributes() const;
+ std::string serializeAttributes(bool escape = true) const;
// serialize child elements as html string
- std::string serializeChilds() const;
+ std::string serializeChilds(bool escape = true) const;
// serialize itself and children as html string
- std::string serialize() const;
+ std::string serialize(bool escape = true) const;
// debug
std::string toString(bool tree = false, uint depth = 0) const;
diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp
index 2a0ca3f34..107ab107a 100644
--- a/nel/src/gui/group_html.cpp
+++ b/nel/src/gui/group_html.cpp
@@ -6793,7 +6793,7 @@ namespace NLGUI
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
- std::string content = strFindReplaceAll(elm.serializeChilds(), std::string("\r"), std::string(""));
+ std::string content = strFindReplaceAll(elm.serializeChilds(false), std::string("\r"), std::string(""));
CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, content, _TextAreaMaxLength);
if (textArea)
@@ -6826,7 +6826,7 @@ namespace NLGUI
// if (!_ReadingHeadTag) return;
// consume all child elements
- _TitleString = strFindReplaceAll(elm.serializeChilds(), std::string("\t"), std::string(" "));
+ _TitleString = strFindReplaceAll(elm.serializeChilds(false), std::string("\t"), std::string(" "));
_TitleString = strFindReplaceAll(_TitleString, std::string("\n"), std::string(" "));
setTitle(_TitleString);
}
diff --git a/nel/src/gui/html_element.cpp b/nel/src/gui/html_element.cpp
index a8038be7d..f4e770a4a 100644
--- a/nel/src/gui/html_element.cpp
+++ b/nel/src/gui/html_element.cpp
@@ -155,7 +155,7 @@ namespace NLGUI
switch(val[pos])
{
case '"': ret.append("""); break;
- case '\'': ret.append("'"); break;
+ case '\'': ret.append("'"); break;
case '&': ret.append("&"); break;
case '<': ret.append("<"); break;
case '>': ret.append(">"); break;
@@ -168,7 +168,7 @@ namespace NLGUI
}
// ***************************************************************************
- std::string CHtmlElement::serializeAttributes() const
+ std::string CHtmlElement::serializeAttributes(bool escape) const
{
std::string result;
for(std::map::const_iterator it = Attributes.begin(); it != Attributes.end(); ++it)
@@ -182,30 +182,30 @@ namespace NLGUI
{
result += " ";
}
- result += htmlEscape(*it2);
+ result += (escape ? htmlEscape(*it2) : *it2);
}
result += "\"";
}
else
{
- result += " " + it->first + "=\"" + htmlEscape(it->second) + "\"";
+ result += " " + it->first + "=\"" + (escape ? htmlEscape(it->second) : it->second) + "\"";
}
}
return result;
}
// ***************************************************************************
- std::string CHtmlElement::serializeChilds() const
+ std::string CHtmlElement::serializeChilds(bool escape) const
{
std::string result;
for(std::list::const_iterator it = Children.begin(); it != Children.end(); ++it)
- result += it->serialize();
+ result += it->serialize(escape);
return result;
}
// ***************************************************************************
- std::string CHtmlElement::serialize() const
+ std::string CHtmlElement::serialize(bool escape) const
{
if (Type == TEXT_NODE)
{
@@ -214,12 +214,14 @@ namespace NLGUI
parent->ID == HTML_NOSCRIPT))
{
return Value;
- } else {
+ } else if (escape) {
return htmlEscape(Value);
+ } else {
+ return Value;
}
}
- std::string result = "<" + Value + serializeAttributes() + ">";
+ std::string result = "<" + Value + serializeAttributes(escape) + ">";
if (ID == HTML_AREA || ID == HTML_BASE || ID == HTML_BR ||
ID == HTML_COL || ID == HTML_EMBED || ID == HTML_HR ||
@@ -234,7 +236,7 @@ namespace NLGUI
result += "\n";
if (!Children.empty())
- result += serializeChilds();
+ result += serializeChilds(escape);
result += "" + Value + ">";