Click here to Skip to main content
15,797,984 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:

My C# application allows users to search for records which I get from a webservice.

I want users to be able to search against a field which has records with non-ascii (characters with accents, tildes etc) with pure ascii search texts.

For example I want to return a record with searchfield value "Ãbrqaus" when my user enters the search text "Abrqaus".

How best can I go about this.

Kind Regards

This is a nice one. The key search word for this is "diacritics"!!! Use this in google and the answers will come :-D

Good luck!
Share this answer
I found this using google:
public static string RemoveDiacritics(string s)
    string normalizedString = s.Normalize(NormalizationForm.FormD);
    StringBuilder stringBuilder = new StringBuilder();
    for (int i = 0; i < normalizedString.Length; i++)
        char c = normalizedString[i];
        if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)
    return stringBuilder.ToString();
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900