/// <summary> /// Removes HTML tags from a string and converts escaped characters. /// </summary> public string HtmlToText(string html) { if (html.IndexOfAny(new char[] { '<', '&' }) == -1) { return(html); } var builder = new StringBuilder(); var parser = new XmlParser(html); while (parser.NextTokenType != XmlTokenType.None) { if (parser.NextTokenType == XmlTokenType.Content) { builder.Append(System.Web.HttpUtility.HtmlDecode(parser.NextToken.ToString())); } parser.Advance(); } return(builder.ToString()); }