Answered by:
how can I return both accented and non-accented letters from a non-accented search string (and vice versa)

Question
-
hi there,
I've just read a few things about this but fail to understand.
Is there a simple way for me to query my database (it's a French/English dictionary)
and have search term: "mange" return both "mange" and "mangé"
there are many more examples with other accents so I was hoping for a very simple piece of code to say "look let's just ignore accents here and return everything"
is there such a thing as Accent Sensitivity ON/OFF ???
the dictionary is in isolated storage and I'm using a simple LINQ query with Contains(searchterm)
thanks for your help!
cypripri
Wednesday, June 18, 2014 10:06 AM
Answers
-
Hi,
You'll find interesting stuff here: Ignoring accented letters in string comparison
Cheers,
Christian H.The best is still to come ;)
- Marked as answer by cypripri Wednesday, June 18, 2014 11:34 AM
Wednesday, June 18, 2014 11:20 AM
All replies
-
Hi,
You'll find interesting stuff here: Ignoring accented letters in string comparison
Cheers,
Christian H.The best is still to come ;)
- Marked as answer by cypripri Wednesday, June 18, 2014 11:34 AM
Wednesday, June 18, 2014 11:20 AM -
What database are you using? In general letters with accents are stored as another letter inside the database entirely - it's not stored as e + ´ for example. I'd likely opt for using Regular Expressions where I replace the search string with a Regular Expression that matches for all variants - e.g.:
mange => mang[eéèê]
basically you replace every occurence of the letters that might have accents with a character class that matches all of the different versions.
SQLite supports Regular Expressions as described here: http://stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query
- Proposed as answer by Oliver Ulm Wednesday, June 18, 2014 11:23 AM
Wednesday, June 18, 2014 11:23 AM -
thanks a lot for the link which lead me to this particular post: http://stackoverflow.com/questions/7418624/linq-where-ignore-accentuation-and-case?lq=1 which is excatly what I need. thanks!
cypripri
Wednesday, June 18, 2014 11:34 AM -
thanks it's a simple table in isolated storage of the WP8 app, I'm querying using LINQ and now found this post which looks like just the job. thanks for your help!
http://stackoverflow.com/questions/7418624/linq-where-ignore-accentuation-and-case?lq=1
cypripri
Wednesday, June 18, 2014 11:36 AM