JSON, URL-encode, and UTF-8

J. Landman Gay jacque at hyperactivesw.com
Thu Aug 20 22:13:11 EDT 2015


Here's a test. This posts just fine in LC 6.x but fails in 7.0.6 and 7.1rc1.

Make a field with this in it:

    [{"Meals":"Yes","Purpose":"Business"}]

Now put this into a button or card script:

constant kServerURL = "https://www.domain.com/results.php"  --### use a 
valid URL here


command sendToServer
   if the version < 7 then
     put fld 1 into tData
     put "json=" before tData
   else
     put textEncode(fld 1,"UTF8") into tData
     put textEncode("json=",UTF8) before tData
   end if
   post tData to kServerURL
   put it into tResponse
   put the result into tErr
   breakpoint -- so you can see it
end sendToServer

If someone can test this against a simple echo PHP maybe it will tell us 
something. The real server returns empty in LC 7 and "OK" in LC 6.

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




More information about the Use-livecode mailing list