[Catalyst] UTF8 and content length

Kroshka Yenot trashbox at cary.lv
Fri Jul 15 11:06:14 GMT 2016


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20160715/8989e3da/attachment.htm>


More information about the Catalyst mailing list