[dancer-users] Returning JSON Data

Kadir Beyazlı kadirbeyazli at gmail.com
Mon Sep 14 08:19:55 BST 2015

Hi Russel,

On Mon, Sep 14, 2015 at 2:19 AM, Russell Jenkins
<russell.jenkins at strategicdata.com.au> wrote:
> 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.
[KB] I did not specify UTF-8, but my display problem for Turkish
characters is still going on.
I am returning JSON data from file myproject.pm and using JSON data at
 file report.js.
My files (myproject.pm and report.js) character sets are also UTF-8.
At old method, when I set content to UTF-8, it was solved

> 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.
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Kadir Beyazlı
Computer Engineer
GSM : +90 535 821 50 00

More information about the dancer-users mailing list