Are these correct, in order to send an array using sockets between standalones, even on different OS/mobile?
Code: Select all
function EncodeMyData pArray
return textEncode(arrayEncode(pArray),"utf-8")
end EncodeMyData
function DecodeMyData pArray
put TextDecode(pArray,"utf-8") into pData
try
put ArrayDecode(pData) into TheData
catch errorVariable
--is not an array answer errorVariable
put pData into TheData
end try
return TheData
end DecodeMyData
This works, but the string to send is much longer:
Code: Select all
function EncodeMyData pArray
return TextEncode(base64Encode(ArrayEncode(pArray)))
end EncodeMyData
function DecodeMyData pArray
put base64Decode(TextDecode(pArray)) into pData
try
put ArrayDecode(pData) into TheData
catch errorVariable
--is not an array answer errorVariable
put pData into TheData
end try
return TheData
end DecodeMyData