[Catalyst] Fix for content-length issue introduced with Catalyst 5.8.x

Dominic Germain mailinglists at sogetel.com
Thu Feb 16 02:51:34 GMT 2012


Hi,

We just update from Catalyst 5.7.x to Catalyst 5.90007.

All our apps code and our DBs are in ISO-8859-1 encoding.  View::TT is conf=
igured to output stuff as UTF-8 and everything is working fine until the up=
date.  It means that there is some re-encoding occurring somewhere in Catal=
yst View processing.

The problem is quite simple:  Catalyst is unable to figure out the right co=
ntent-length as soon we have characters that requires two bytes in UTF-8.  =
French accent characters like "=E9", "=EA", '=E8", "=E0", etc. are good exa=
mples.  Previously, "bytes::length" was used and it works fine but the code=
 was changed to just "length".

Because of that, if I have 100 accentuated characters in the body, the last=
 100 characters will be chopped by all browsers that are taking care of con=
tent-length (Chrome and Safari for example).  It seems that FF doesn't care=
 about content-length, it displays everything.  Don't know about IE.

reverting back to the old way does the trick...


Catalyst.pm version 5.90007 line 1886

>         else {
>             # everything should be bytes at this point, but just in case
>             $response->content_length( length( $response->body ) );
>         }


fix inspired from 5.7 branch

>         else {
>             # everything should be bytes at this point, but just in case
>             $response->content_length( bytes::length( $response->body ) );
>         }



I hope this will be fixed in a future release.  It seems that there is some=
 people complaining about that.

regards,


Dominic Germain
---------------------------------------------
Administrateur r=E9seau / Network administrator
Sogetel
www.sogetel.net

mailinglists at sogetel.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120215/ed432=
ce5/attachment.htm


More information about the Catalyst mailing list