SQLite Forum

Table-valued function encoding
Login

Table-valued function encoding

(1) By Mark Benningfield (mbenningfield1) on 2021-12-02 18:32:21 [link] [source]

I have a table-valued function that processes strings. Everything works and it passes all the tests, with databases in both UTF-8 and UTF-16 encoding.

TL;DR: Is there not any way to define the preferred text encoding for a table-valued function ?

As I was developing the virtual table module, I looked high and low for some point in the process where I could spec a preferred text encoding. Couldn't find anything about it, so I pressed forward and just took the UTF-8 bytes from the supplied sqlite3_value objects supplied to the xFilter() implementation, leaving it to SQLite to convert wide strings when necessary.

As I said, it all works just fine. I would like to avoid the text conversion if possible (it's one of my programmer's OCD tics; don't do work which you don't have to do).

(2) By Gunter Hick (gunter_hick) on 2021-12-03 07:40:10 in reply to 1 [source]

AFAICT a preferred encoding can only be used when creating regular user defined functions. E.g. if there are different implementations for different encodings.