UrlEncode and ArrayEncode

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
trevix
Posts: 361
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

UrlEncode and ArrayEncode

Post by trevix » Wed Feb 21, 2018 1:07 pm

Someone can explain me why this does not works?

Code: Select all

on mouseUp 
   put "me" into tArrayData["one"]
   put "me you" into tArrayData["two"]
   put arrayEncode(tArrayData) into tArrayData
   put urlEncode(tArrayData) into tArrayData
   
   put urlDecode(tArrayData) into tArrayData
   put arrayDecode(tArrayData) into tArrayData
   --tArrayData is no longher an array
   put the keys of tArrayData
end mouseUp
Trevix

Klaus
Posts: 9846
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: UrlEncode and ArrayEncode

Post by Klaus » Wed Feb 21, 2018 2:46 pm

Hi Trevix,

use "base64encode" instead of "urlencode"!
"ArrayEncode" produces BINARY data and "urlencode" will corrupt it, "base64encode" does not.

Works:

Code: Select all

on mouseUp 
   put "me" into tArrayData["one"]
   put "me you" into tArrayData["two"]
   put arrayEncode(tArrayData) into tArrayData
   put base64encode(tArrayData) into tArrayData
   
   put base64Decode(tArrayData) into tArrayData
   put arrayDecode(tArrayData) into tArrayData
   put the keys of tArrayData
end mouseUp
Best

Klaus

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”