Encode string into HTML
if (plainText == null || plainText.length() == 0)
{
return "";
}
StringBuffer result = new StringBuffer(plainText.length());
for (int index=0; index<plainText.length(); index++)
{
char ch = plainText.charAt(index);
switch (ch)
{
case '"":
result.append(""");
break;
case '&":
result.append("&");
break;
case '<":
result.append("<");
break;
case '>":
result.append(">");
break;
default:
if (ch < 128)
{
result.append(ch);
}
else
{
result.append("").append((int)ch).append(";");
}
}
}
return result.toString();