Accented chars in Android embeded Sqlite.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Accented chars in Android embeded Sqlite.

Yahoo-28
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:

agora

água

através

and so on

 

It’s possible? Or better to commit suicide ;-)

Thanks in advance

You’re all aces in my book.

 

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Accented chars in Android embeded Sqlite.

Richard Hipp-3
On Tue, May 15, 2012 at 9:23 PM, Yahoo <[hidden email]> wrote:

> 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:
>
> agora
>
> água
>
> através
>
> and so on
>

There is a file in the latest source tree named "test_spellfix1.c" which
includes an application-defined SQL function named
"spellfix1_translit(X)".  See
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.
Example:

      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.


>
>
>
> It’s possible? Or better to commit suicide ;-)
>
> Thanks in advance
>
> You’re all aces in my book.
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Accented chars in Android embeded Sqlite.

Karl Edwall
In reply to this post by Yahoo-28
Hello Yahoo,

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.

Regards,

Karl Edwall

Wednesday, May 16, 2012, 11:23:25 AM, you wrote:
Y> Hi everyone!

Y> I’m Brazilian, also, Android Dev.

Y> I’m in a struggle with Sqlite and accented chars such as ‘á’ or ‘é’.

Y> What I’m 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.

Y>  

Y> What I need is something like this:

Y> select * from table where column like ‘a%’

Y> and result be:

Y> agora

Y> água

Y> através

Y> and so on

Y>  

Y> It’s possible? Or better to commit suicide ;-)

Y> Thanks in advance

Y> You’re all aces in my book.

Y>  

Y> _______________________________________________
Y> sqlite-users mailing list
Y> [hidden email]
Y> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users