Subject: | Content Length and UTF-8 Characters |
Date: | Fri, 3 Jul 2015 15:53:15 -0300 |
To: | <bug-Apache-Template [...] rt.cpan.org> |
From: | "Troy Morehouse" <troymore [...] nbnet.nb.ca> |
It appears that when setting:
TT2Headers length
And the resulting template contains UTF8 characters that have an ordinal
value greater than 255, the resulting content gets truncated by
intermediate proxies and or the client. On Chrome, the console dhows there
error:
<http://stackoverflow.com/questions/29894154/chrome-neterr-incomplete-chunke
d-encoding-error> net::ERR_INCOMPLETE_CHUNKED_ENCODING
By Setting:
TT2Headers none
appears to fix the problem.
In Template::Apache::Service, I see that the length of the content is
calculated by the perl "length" function. This function computes character
length, rather than byte length. A simple fix would be:
use Encode ();
$r->headers_out->add('Content-Length' =>
length(Encode::encode_utf8($$content)))
if $all or $headers->{ length };
Message body not shown because it is not plain text.