> Hi everyone!
> I’m Brazilian, also, Android Dev.
> I’m in a struggle with Sqlite and accented chars such as ‘á’ or ‘é’.
> What I’m trying to do is a select with where accent insensitive.
> For months I have having research over and over the internet to accomplish
> that, but, unfortunately unsuccessful.
> What I need is something like this:
> select * from table where column like ‘a%’
> and result be:
> and so on
There is a file in the latest source tree named "test_spellfix1.c" which
includes an application-defined SQL function named
http://www.sqlite.org/src/artifact/495535f3eb57a?ln=1152-1171 for the
implementation. The spellfix1_translit(X) function attempts to convert its
input string X into a pure ASCII transliteration. In other words, it
removes the accented characters, replacing them with ASCII equivalents.
SELECT spellfix1_translit('água'); -- returns agua
You could, perhaps, add such a function to your application, then use it to
accomplish what you describe above:
SELECT * FROM table WHERE spellfix1_tanslit(column) LIKE 'a%';
Note that spellfix1 is not currently a part of any build and is
unsupported. But you can use it as a guide to your own implementation.
Another possible solution seeing you're on the Android platform and writing in Java is to use a less high tech solution and store an
additional column with a copy of the text you're searching where you've stripped the accents out and use that for the search instead.
It would use additional storage but would give you the control you're after in a simple manner.
Wednesday, May 16, 2012, 11:23:25 AM, you wrote:
Y> Hi everyone!
Y> Im Brazilian, also, Android Dev.
Y> Im in a struggle with Sqlite and accented chars such as á or é.
Y> What Im trying to do is a select with where accent insensitive.
Y> For months I have having research over and over the internet to accomplish
Y> that, but, unfortunately unsuccessful.