http: fix chunk length calculation if write was called with encoding.

The chunk length calculation when using chunked transfer encoding
and a string encoding of Base64 was incorrect.  This patch properly
calculates the chunk length, by getting the number of bytes when
the string is decoded rather then just the length of the string.

Fixes issue: #5777