Re: Utf-8 and Content-Length header

Re: Utf-8 and Content-Length header

am 08.06.2006 16:22:17 von gisle

Pav Lucistnik writes:

> A general problem exists in libwww when POSTing data to HTTP servers,
> Content-Length headers and syswrite() calls use length() function over
> payload to determine it's size. This fails on Utf-8 encoded data,5D
> because length() function returns the count of _characters_, not count
> of bytes. It leads to a message truncated.

If the data you put into the request content is UTF-8 encoded data
then there is no problem. Encoded text is already bytes and that's
what the content and headers of HTTP::Message objects are supposed to
be. Use the Encode module to convert Unicode strings that you add to
the request.

--Gisle