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,
 Russell.