Re: Utf-8 and Content-Length header

Gisle Aas <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Pav Lucistnik <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.