properly setting the content-length header when multibyte characters are involved