Вопрос

I have a UISearchBar implemented and working correctly. The only problem is, if i type in the search bar the letter " e " it will only show me words starting with the letter " e " correctly, neglecting all the words starting/having the letter " é ". I made sure all my queries concerning loading the database into NSMutableArray are UTF-8 encoded correctly. But the problem is, how can i show results of " e " and " é " when the user presses " e ". Practically like all the french dictionaries work!
This is how i filter the words when the user presses any letter :

for (Author* author in theauthorsLoadedFinal2)

{           
    NSRange nameRange = [author.name  rangeOfString:text options:NSAnchoredSearch ];

    NSRange descriptionRange = [author.genre rangeOfString:text options:NSAnchoredSearch];
    if(nameRange.location != NSNotFound || descriptionRange.location != NSNotFound)
    {
        [filteredTableData addObject:author];
                  }


}

}

Many Thanks

Это было полезно?

Решение

Based on Larme's tip, THe answer was pretty simple ! for all of the future encounters of this problem, use the following code :

NSRange nameRange = [author.name  rangeOfString:text options:NSAnchoredSearch | NSDiacriticInsensitiveSearch];

NSRange descriptionRange = [author.genre rangeOfString:text options:NSAnchoredSearch | NSDiacriticInsensitiveSearch];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top