use getBytes with utf-8 to get the bytes length for setting content length header