JSON, URL-encode, and UTF-8

J. Landman Gay jacque at hyperactivesw.com
Mon Aug 17 16:54:57 EDT 2015


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.

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?


On 8/17/2015 3:28 PM, Monte Goulding wrote:
> I think we would need to see the API to know about the urlEncoding.
> Is it a parameter in your query string? If you need to urlEncode it
> will be the last thing you do. If you are using one of the script
> libraries the UTF8 encoding may be done for you. If you are using
> mergJSON then UTF8 encode anything that's not ASCII before you JSON
> encode.
>
> Cheers
>
> Monte
>
> Sent from my iPhone
>
>> On 18 Aug 2015, at 4:41 am, J. Landman Gay
>> <jacque at hyperactivesw.com> wrote:
>>
>> I've confused myself. I need to send JSON to a server. The values
>> will have foreign characters in them. So I think I need to use
>> textEncode to convert it to UTF8 and also it needs to be URL
>> encoded. Is that right? And if so, what order do I do it in?
>>
>> Do I URL-encode each value in the array, then create the JSON, then
>> textEncode that? Or some other order? Or does textEncoding remove
>> the need to URL encode?
>
> _______________________________________________ use-livecode mailing
> list use-livecode at lists.runrev.com Please visit this url to
> subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list