Reputation: 1
I have a problem with results are empty because of special characters like <
are not searching in my query results so what I have done is this code (I have already tested this with Regex
and WebUtility.HtmlDecode("<")
it always returns an empty result.)
private IEnumerable < string > GetRowValues(DataRow dr) {
foreach(DataColumn col in DataResult.Columns)
yield return replaceSpecialChar(dr[col].ToString());
}
private string replaceSpecialChar(string text) {
if (text.Contains("<")) {
text = text.Replace("<", "<");
System.Diagnostics.Debug.WriteLine(text);
}
return text;
}
Upvotes: 0
Views: 63
Reputation: 45947
You're mixing up encode and decode
string result = WebUtility.HtmlEncode("<"); //<
Upvotes: 3