You are mixing text encoding lengths. When you want the length of the UTF-16 data, you need to use sqlite3_column_bytes16. Since the "character width" is TWO (16-bits) not ONE (8-bits), you need to add TWO bytes for the TWO zero terminator bytes.
You are mixing text encoding lengths. When you want the length of the UTF-16 data, you need to use sqlite3_column_bytes16. Since the "character width" is TWO (16-bits) not ONE (8-bits), you need to add TWO bytes for the TWO zero terminator bytes.