Fix calculation of HTTP chunk length when using chunked encoding and an encoding passed to .write().