function
html_encode(str)
{
var
s =
""
;
if
(str.length == 0)
return
""
;
s = str.replace(/&/g,
">"
);
s = s.replace(/</g,
"<"
);
s = s.replace(/>/g,
">"
);
s = s.replace(/ /g,
" "
);
s = s.replace(/\'/g,
"'"
);
s = s.replace(/\
"/g, "
"
");
s = s.replace(/\n/g, "
<br>
");
return s;
}
function html_decode(str)
{
var s = "
";
if (str.length == 0) return "
";
s = str.replace(/>/g, "
&
");
s = s.replace(/</g, "
<
");
s = s.replace(/>/g, "
>
");
s = s.replace(/ /g, "
");
s = s.replace(/'/g, "
\'
");
s = s.replace(/"/g, "
\
""
);
s = s.replace(/<br>/g,
"\n"
);
return
s;
}