According to the following table for the ISO-8859-1 standard, there seems to be an entity name and an entity number associated with each reserved HTML character.
So
I made this function, I think it will help
string BasHtmlEncode(string x) { StringBuilder sb = new StringBuilder(); foreach (char c in x.ToCharArray()) sb.Append(String.Format("{0};", Convert.ToInt16(c))); return(sb.ToString()); }