I am creating a small app in C# to search for filenames based on information passed from a SQL query. Within the data passed from the SQL query there will be on occasion (po
var s1 = ToASCII("Hervé");
var s2 = ToASCII("Mañana");
string ToASCII(string s)
{
return String.Join("",
s.Normalize(NormalizationForm.FormD)
.Where(c => char.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark));
}
If you're running against MS-SQL server, see COLLATE in the online help. You can functionally change the encoding on the fly.