Subject Re: [firebird-python] Re: Can't search DB with accents
Author Werner F. Bruhin
On 02/09/2010 18:41, starglider101@... wrote:
>
>
>
>
>
>
>
> I make some tests:
> If I convert the data to PostgreSQL it works.
> Also if I use sqlalchemy the problem persist, that concluded the problem is in the driver.
>
> Any ideas?
>
> --- In firebird-python@yahoogroups.com, starglider develop<starglider.dev@...> wrote:
>> Hi,
>> I'm developing a new application to store book data,
>> my problem is when I do a search with accents like "Solidão" it gives no
>> results.
>> Searching a word without accents works great.
>>
>> Thank you in advance for your help.
I use FB 2.1 and SQLAlchemy 0.5.8 and doing this works fine for me:

aFilter = "%s LIKE '%s%s%s'" % ('winename',
'%',
u'Châ',
'%')


for instance in session.query(db.Cellarbook).filter(aFilter).all():
print instance.winename.encode(), type(instance.winename)

SQLAlchemy version: 0.5.8
Château de Laussac AC <type 'unicode'>
Château du Rocher <type 'unicode'>
Château du Port Cuvée Prestige <type 'unicode'>
Grand Barossa Château Tanunda <type 'unicode'>

and so on.....

If you just start you might want to look into using FB 2.5 which has
some nice new stuff - e.g. case-insensitive and accent insensitive
collation.

Werner