Fix 'Content-Length mismatch' error

Fixed byte length error for multi-byte characters.