[EMAIL PROTECTED] schrieb:
> Hello, I am switching from VB to python.
> I managed to crank my files into a sqlite
> dbase, converting the original names to
> unicode with s=unicode(s,"latin-1").
> Everything is working fine, but when
> I query the dbase with dbapi2 and want
> to retrieve names this way:
> 'Select * from table where name like "José%"´
> The ´José's don´t appear in my list.
> Other names lets say "Maria%" works fine.
> Also "João%" doesn´t work. 
> Anybody knows a trick?
Maybe it helps to encode the strings in question to utf-8 before. 
Assuming that José is in latin-1, this would be:


"Select * from table where name like '%s%%'" %
"José".decode("latin-1").encode("utf-8")

(I get an unwanted linebreak in the code above, its supposed to be on 
one line)

The reason is that AFAIK sqllite stores unicode internally as utf-8 
(makes sense), and the sql interface only takes byte-strings, which lose 
the encoding-option.

Regards,

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to