I'm viewing an Arabic with diacritics (tashkel) text in a UIWebView. I also have a Search View.
I want to give the UIWebView a keyword and UIWebView finds and highlights it, but the search should ignore the diacritics.
The main text should remain with the diacritics.
example : if the text is " الَلَهُم صَلِ عَلى مُحَمّد و آل مُحمد " and I tell the UIWebView to search for " محمد " it should highlight "مُحَمّد " and " مُحمد " regardless of all the diacritics.
I think of two approaches : 1- I do the find and highlight by Javascript after the UIWebView load. 2- I edit the text by Objective-C before loading the UIWebView.
You have to first strip all the diacritics from the string, then you can compare without any diacritics. Use regular expression to remove the characters you don't want. Check out this fiddle i did, inside the strip()
function you need to add all the diacritics you need to take out.
hope this helps.