Amit Vaishnava
Amit Vaishnava

Reputation: 306

How to search special character like french character from SQLite database

In my database i had one column as name, where in this column it has name of all recipe names with english and french character. When i search a string like query:

Select recipe.name from recipe_table where name LIKE = %crepe% 

it gives me no result. But it should return one result this-"crèpes"

So i need: search through english alphabet and give me result of all english + french alphabet , it means all result.

thank you in advance .

Upvotes: 2

Views: 611

Answers (2)

Amit Vaishnava
Amit Vaishnava

Reputation: 306

Instead of searching Spanish character I had created one more column as name2 where i convert all Spanish name to English name.

And then I search English characters from column name2.

Upvotes: 3

Paul Chernenko
Paul Chernenko

Reputation: 706

First of all I think that the encoding of the database must be UTF-8.

Then:

Select recipe.name from recipe_table where name LIKE = %crepe%

will find any values that have 'crepe' in any position, and you need 'crèpe'. Possibly you can change french characters by _ .

 Select recipe.name from recipe_table where name LIKE = %cr_pe%

But I'm not sure.

Also there are some solutions: 1) Try to search how to rebuild android's sqlite with icu support. 2) Or use custom cursor wrapper like this

Upvotes: 0

Related Questions