2

Friends in my ionic application API return data's are in Spanish language, I want to implement local search(sub string matching) in these data. Unfortunately accent/diacritics are does not match with normal character Eg. 'María', here 'í' is different from normal 'i' When I search using key word 'maria' i don't get the result.

How can I check 'í' is equal to 'i' and other characters.

Mebin Xtapps
  • 51
  • 1
  • 1
  • 8
  • Your question has been asked before. I googled 'javascript string search ignore accents' and found several StackOverflow answers: [Using JavaScript to perform text matches with/without accented characters](https://stackoverflow.com/questions/5700636/using-javascript-to-perform-text-matches-with-without-accented-characters), [string.search() that ignores accented characters?](https://stackoverflow.com/questions/11115417/string-search-that-ignores-accented-characters), [How to search a string ignoring accent characters (e.g. ã = a)](https://stackoverflow.com/q/5875389/1280867) and more – Martin Oct 19 '17 at 13:25
  • Thanks for your suggestion! I got that tums after posting this question. – Mebin Xtapps Oct 20 '17 at 13:11

1 Answers1

0

Based on the answer of this question: Remove accents/diacritics in a string in JavaScript

I don't know how you are doing your search, but it's normal that you don't get any result with í and i, they don't have the same ASCII code.

What you can do during your search is replacing temporary all accents and diacritics in your search text and in your data text.

Zooly
  • 4,736
  • 4
  • 34
  • 54