fix wrong string byte size when containing multi-byte characters