sqlite user-defined functions & unicode issue

Gerhard Häring gh at ghaering.de
Thu Jan 25 17:36:48 CET 2007

Ben Wolfson wrote:
> I've got a db some of whose elements have been created automatically
> from filesystem data (whose encoding is iso-8859-1).  If I try to
> select one of those elements using a standard SQL construct, things
> work fine:
> [...]
> How can I get around this?  I really want to be able to search by
> regexp, and not just the standard SQL %-pattern.

Looks like SQLite does not want to pass non-UTF8 strings to functions. 
The attached script shows that it does work with unicode and buffer 
(BLOB) parameters, but not with non-UTF8 strings.

Text has to be encoded in UTF-8 in SQLite, it's just not enforced 
usually. Looks like SQLite enforces it here, though. Kind of ...

-- Gerhard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_func.py
Type: text/x-python
Size: 650 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070125/d26f000a/attachment.py>

More information about the Python-list mailing list