forked from enlightenment/efl
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:
parent
c743e4f56c
commit
5ceb0ce407
|
@ -236,14 +236,11 @@ EAPI int
|
||||||
evas_common_encoding_utf8_get_len(const char *buf)
|
evas_common_encoding_utf8_get_len(const char *buf)
|
||||||
{
|
{
|
||||||
/* returns the number of utf8 characters (not bytes) in the string */
|
/* 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;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue