If the SQLite glue in Pike expects unencoded Pike strings (since it will do the UTF8 conversion internally) you should feed it unencoded Pike strings and not UTF8 data.
- User provides UTF-8 string as input (s1)
If you know your input is UTF8, simply call utf8_to_string() before handing the data to the Pike glue.
There is little (if any) sense to encode 8-bit values into 8-bit values, expanding string (size) on the way, don't you think so?
A generic 8-bit string doesn't contain any info that tells what kind of encoding that has been used. That's something you need to keep track of elsewhere. If you use Pike strings all the way you needn't worry about this; it's only when you deali with I/O (files, http, keyboard input etc) it becomes an issue, and then various methods has been devised to handle it (the <?xml version="1.0" encoding="..."?> header is one example).