+void yaz_stemmer_stem(yaz_stemmer_p stemmer, struct icu_buf_utf16 *dst, struct icu_buf_utf16* src, UErrorCode *status)
+{
+ switch(stemmer->implementation) {
+ case yaz_snowball: {
+ struct icu_buf_utf8 *utf8_buf = icu_buf_utf8_create(0);
+ icu_utf16_to_utf8(utf8_buf, src, status);
+ if (*status == U_ZERO_ERROR) {
+ const sb_symbol *cstr = (const sb_symbol*) icu_buf_utf8_to_cstr(utf8_buf);
+ const sb_symbol *sb_symbol = sb_stemmer_stem(stemmer->sb_stemmer, cstr, utf8_buf->utf8_len);
+ if (sb_symbol == 0) {
+ icu_buf_utf16_copy(dst, src);
+ }
+ else {
+ const char *cstr = (const char *) sb_symbol;
+ icu_utf16_from_utf8_cstr(dst, cstr , status);
+ }
+ }
+ icu_buf_utf16_destroy(utf8_buf);
+ return ;
+ break;
+ }
+ default: {
+ // Default return the same as given.
+ icu_buf_utf16_copy(dst, src);
+ }
+ }
+}