Hi Thanks for the quick reply. I was rather surprised to read on the supplied link, I always assumed that sqlite would handle utf-8 upper / lower case. What version is the sqlite bundled with web2py 1.54 windows?
Cheers Petros Diveris On Jan 2, 1:27 pm, mdipierro <[email protected]> wrote: > This > > http://www.sqlite.org/lang_expr.html > > says: > > "A bug: SQLite only understands upper/lower case for 7-bit Latin > characters. Hence the LIKE operator is case sensitive for 8-bit > iso8859 characters or UTF-8 characters. For example, the expression > 'a' LIKE 'A' is TRUE but 'æ' LIKE 'Æ' is FALSE." > > perhaps it is possible to redefine upper using stored procedures... > but Python itself does not seem to support this either: > > >>> a="\303\206" > >>> print a > Æ > >>> print a.lower() > > Æ > > If anybody has any suggestion I would like to know. If there is a > workaround in Python, we can use sqlite3_create_function. > > Massimo > > On Jan 2, 5:01 am, Petros Diveris <[email protected]> wrote: > > > Hi everyone and happy neww year! > > > I have come across a very strange problem where I am trying to select > > from an sqlite table with > > > db.babel.definition.upper().like("'%"+me.word.upper()+"%'") ) which > > yields nothing. > > > The same happens if I try using sqlite's upper function > > > db.babel.definition.upper().like("upper('%"+me.word+"%')") ) > > > which also yields nothing. The text I am trying to select is Greek - > > it all works fine with English > > > The same sql statements work fine (they return rows) from native > > sqlite clients (I haven't tried as yet from command line python.) Not > > only it works fine with the native client, it even handles accented > > characters etc. Same with German and umlauts... > > > Has anybody seen anything like this with international text? > > > I have even tried this so to avoid handling the keyword in Python > > > rows=db("upper(definition) like '%' || upper((select word from > > babel where id="+str(me.id)+")) || '%'").select(db.babel.ALL) > > > assuming that something happens on the python side. One would expect > > this to work since the whole string comparison should happen on the > > sqlite side. It still doesn't handle uupper / lower case. Help! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

