[dancer-users] Returning JSON Data

WK wanradt at gmail.com
Tue Sep 29 08:27:53 BST 2015


2015-09-28 18:54 GMT+03:00 Robert Smith <spamfree at wansecurity.com>:


> Here is the output to the browser (broken):
>
> {
>    "1" : {
>       "client_id" : "1123",
>       "name" : "WANSecurity, K.K.",
>       "address" : "æ ±äº¬éƒ½æ¸‹è°·åŒºä¸ŠåŽŸï¼’âˆ’ï¼”ï¼˜âˆ’ï¼‘ï¼’ ã
> ¨ã‚ˆä»£ã€…æœ¨ä¸ŠåŽŸã‚³ãƒ¼ãƒ ï¼ƒï¼’ï¼ ï¼‘",
>       "id" : "1"
>    }
> }
>
> ...

> Is this the expected behavior?
>

I think, it is. I am almost sure, your data is encoded correctly, but
browser does not show it correctly. 'application/json' should be always
encoded in utf-8, but browser may assume it being Latin-1 (or iso8859-1).

You could try requesting with curl and look, what you get. I got correct
output with your conf.

And you may read about same issue here too:
https://github.com/PerlDancer/Dancer2/issues/995

If you need it to show up correctly in browser too, you may set header
yourself "Content-type: application/json;charset=utf-8"


Wbr,
-- 
Kõike hääd,

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


More information about the dancer-users mailing list