[dancer-users] Returning JSON Data

Russell Jenkins russell.jenkins at strategicdata.com.au
Mon Sep 14 00:19:07 BST 2015

On 14/09/2015 3:56 am, Kadir Beyazlı wrote:
> Now my only problem is encoding JSON data.
> My data is Turkish, I was setting charset as follow to display correcty
>   print $q->header(-content_type => "application/json; charset='utf8');
> How will I do it at Dancer2?

Hey Kadir.

You do no need to specify your JSON content as being UTF-8.

RFC4627 states:
"JSON text SHALL be encoded in Unicode. The default encoding is UTF-8"
and goes on to explain how to determine the encoding of the octet stream.

Furthermore, the IANA assignment for 'application/json' includes the 
following note:
"No "charset" parameter is defined for this registration. Adding one 
really has no effect on compliant recipients."

Hope that helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150914/5b7622bb/attachment.html>

More information about the dancer-users mailing list