JSON, URL-encode, and UTF-8

Monte Goulding monte at sweattechnologies.com
Mon Aug 17 17:11:19 EDT 2015

> On 18 Aug 2015, at 6:54 am, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> Thanks Monte. The JSON is created by EasyJSON from a LC array. Most of the values in the array are in foreign languages with lots of non-ascii characters, and those will become the values in the parameter string that I will send in a POST. It doesn't look like EasyJSON does any UTF8 encoding when creating the JSON.

I haven’t used EasyJSON because it was done after mergJSON so I can’t confirm about the utf8. If you are posting JSON then you don’t need to urlEncode. Just set the content type header to application/json
> So I guess I need to UTF8 encode the array before sending it to the JSON parser, then URL-encode the JSON. Is it possible to textEncode a whole array at once without looping through all the elements?

No, just UTF8 encode any elements (or keys) that’s not likely to be ASCII.

More information about the Use-livecode mailing list