Possible Duplicate:
How to convert a Unicode character to its ASCII equivalent
How do I remove diacritics (accents) from a string in .NET?
Convert Unicode char to closest (most similar) char in ASCII (.NET)
I'll be taking in names that won't necessarily be English and need to convert them to their basic counterparts. I.e. Transliteration é to e
I don't have to worry about converting for example Japanese to english letters.
Is there any way to do this?
Thanks
Answer:
public void ConvertDiacritic()
{
nameInFull = nameInFull.Normalize(NormalizationForm.FormD);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < nameInFull.Length; i++)
{
UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(nameInFull[i]);
if (uc != UnicodeCategory.NonSpacingMark)
{
sb.Append(nameInFull[i]);
}
}
nameInFull = sb.ToString().Normalize(NormalizationForm.FormC);
}