Jeff Martin
Jeff Martin

Reputation: 11022

How can I search for strings with characters not on the keyboard (non-english)?

I have a search form that I want my users to be able to enter English character equivalents for non-English characters.

For example. To find Ælfred, the user could search for "Ælfred" or "AElfred".
the search should also be case insensitive so "aelfred" would work.
I also have it searching so that, by default, it matches the beginning of the string so a search of "Æ" or "AE" or even "A" would contain Ælfred in the results.

Other conversions such as ê -> e, å -> a, would need to be accounted for.

I am using ASP.NET with a SQL backend. Are there any standard libraries that help out with this sort of search?

Upvotes: 4

Views: 250

Answers (1)

Eduardo Molteni
Eduardo Molteni

Reputation: 39453

Not always there is a English character equivalent to a non-English character, but can try to store a Normalized string in a different field using string.Normalize and comparing to that.

MS SQL fields and full text search catalogs can be accent-insensitive and case-insensitive, so you got the other cases covered.

Upvotes: 1

Related Questions