else
{
str = eina_ustrbuf_string_get(n->unicode);
- alloc_str = eina_unicode_strdup(str + start);
-
- if (off > 0)
- {
- alloc_str[off] = 0;
- }
+ alloc_str = eina_unicode_strndup(str + start, off);
str = alloc_str;
}
}
evas_common_encoding_utf8_get_len(const char *buf)
{
/* returns the number of utf8 characters (not bytes) in the string */
- int index = 0, len = 0;
+ int i = 0, len = 0;
+
+ while (evas_common_encoding_utf8_get_next(buf, &i))
+ len++;
- while (buf[index])
- {
- if ((buf[index] & 0xc0) != 0x80)
- len++;
- index++;
- }
return len;
}