SQLite Forum

sqlite3_bind_text16 & weird AI
Login
sqlite3_bind_text16 internally inspects the passed UTF16 string and modifies it if first bytes look like BOM:

```
** This routine checks for a byte-order mark at the beginning of the 
** UTF-16 string stored in *pMem. If one is present, it is removed and
** the encoding of the Mem adjusted. This routine does not do any
** byte-swapping, it just sets Mem.enc appropriately.
**
** The allocation (static, dynamic etc.) and encoding of the Mem may be
** changed by this function.
SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
...
}
```

Why? If I pass "FEFFsomething" I expect to see exactly that in the db and get exactly that back later.

This weird logic is not mentioned anywhere in the documentation and it's not possible to turn it off.