[Catalyst] UTF8 and content length

John Napiorkowski jjn1056 at yahoo.com
Tue Jul 19 16:10:34 GMT 2016


Looks like to a bug to me, although I'm not personally keen on the auto length setting in Catalyst it should be corrected.  I'm happy to get a patch, or at the very least give me a broken test case (checkout https://github.com/perl-catalyst/catalyst-runtime/blob/master/t/utf_incoming.t 
and see if you can help me figure it out -jnap
(created an issues for this, _https://github.com/perl-catalyst/catalyst-runtime/issues/143


 

    On Friday, July 15, 2016 6:07 AM, Kroshka Yenot <trashbox at cary.lv> wrote:
 

   Hi! if content type is 'application/json' or 'application/json; charset=utf-8' Catalyst sets content length in chars, NOT IN BYTES and I'm getting 
  {"id":1, "msg":"В Питере if content type is 'text/html' Catalyst sets content length in bytes (properly) and everything works fine
  Is there any workaround to configure this behaviour, except setting content length manually everytime ?
  
  my $json_text = '{"id":1, "msg":"В Питере пить"}';
  $c->response->content_type('application/json');
 $c->response->content_length(bytes::length $json_text);
 $c->response->body($json_text);
  Thanks in advance
  
  
_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20160719/9c26c14c/attachment.htm>


More information about the Catalyst mailing list