Evas encoding: Improved evas_common_encoding_utf8_get_len to be more consistent with evas_common_encoding_utf8_get_next. This is a semi fix to the issue with malformed utf8 strings (#670)

SVN revision: 56806
This commit is contained in:
Tom Hacohen 2011-02-08 13:22:10 +00:00
parent c743e4f56c
commit 5ceb0ce407
1 changed files with 4 additions and 7 deletions

View File

@ -236,14 +236,11 @@ EAPI int
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;
}