I’m still confused by utf strings. For simplicity, suppose I set up an sqlite function that takes a single string parameter and I want to scan the string to count the number of occurrences of a certain character . If I knew the string was made up entirely of ascii chars I’d do this
char *c = &sqlite3_value_text(0)[0]; int count=0; while (*c) if (*c++ == SearchChar) count++; How do I do the same thing if the string param is a utf-8 or utf-16 string and the SearchChar is a Unicode character? I’m confused by the fact that Unicode characters are not a fixed number of bytes so if I do this e.g. wchar_t *c = (wchar_t*) sqlite3_value_text(0); does this mean a complete temporary copy of the value of sqlite3_value_text(0) has to be constructed by the compiler such that all characters of the newly constructed string are fixed width? If so, I’m just wanting to check if there’s a way of avoiding this overhead. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users