changed method to get length of UTF8 string