21 namespace Lucene.Net.Search.Highlight
30 public String EncodeText(String originalText)
32 return HtmlEncode(originalText);
38 public static String HtmlEncode(String plainText)
40 if (
string.IsNullOrEmpty(plainText))
45 var result =
new StringBuilder(plainText.Length);
47 for (
int index = 0; index < plainText.Length; index++)
49 char ch = plainText[index];
54 result.Append(
""");
58 result.Append(
"&");
62 result.Append(
"<");
66 result.Append(
">");
76 result.Append(
"&#").Append((
int)ch).Append(
";");
82 return result.ToString();