[dancer-users] Returning JSON Data
WK
wanradt at gmail.com
Mon Sep 14 15:03:30 BST 2015
2015-09-14 15:44 GMT+03:00 Kadir Beyazlı <kadirbeyazli at gmail.com>:
> [KB] I checked, it is UTF-8. But my Turkish characters are still
> broken. My country's character set is iso-8859-9 but UTF8 was always
> enough to display correct data.
> I will search about it.
Actually, right way to emit JSON is to use serializer, so the right
way is something like that:
=======
use Dancer2;
set serializer => 'JSON';
get '/json' => sub {
my $ref = {
BranchID => 'ülane kõnnib öösiti õues',
Branch => 'šaakal kasutab ainult žiletti',
};
return $ref;
};
start;
=======
If you don't use serializer, you have wrong content-type. If you set
content-type by hand, you have wrong content-lenght, etc
Wbr,
--
Kõike hääd,
Gunnar
More information about the dancer-users
mailing list