data.length is not working with utf8 as expected