SQLite Forum

null character sorts greater than 0x7f and less than 0x80
Login
Tcl does have functions for converting to a standard encoding. It's just that very few packages, apparently including sqlite, use them.

I'm in the process of updating Pgtcl to use them.

https://www.tcl.tk/man/tcl8.6/TclLib/Encoding.htm

In my case I discovered it was converting "mathematical fraktur capital a" into "ed a0 b5 ed b4 84" instead of "F0 9D 94 84" and PostgreSQL said "ERROR: invalid byte sequence for encoding "UTF8": 0xed 0xa0 0xb5". Passing through "Tcl_UtfToExternalDString(utf8encoding..." fixed it right up.