Problem with arrayDecode

Alex Tweedly alex at tweedly.net
Sun Jul 5 07:09:44 EDT 2015


You would need to use  a binary file (e.g. "binfile:temp.txt")  for the 
result of arrayencode
(so I might therefore chose  different extension :-)

Alex.


On 05/07/2015 09:46, Peter W A Wood wrote:
> I am having problems with encoding and decoding an array when I save the encoded data to a file and read it back. Here is a simple LiveCode Server script that shows the issue:
>
> 	#coding:utf-8
>
> 	set the outputLineEndings to “lf”					# OS X
> 	set the outputTextEncoding to “utf8”				# OS X
>
> 	put "data.db" into preferences["database”]
> 	put arrayEncode(preferences) into URL “file:temp.txt"
> 	put URL "file:temp.txt" into encodedPrefs
> 	if encodedPrefs is not empty then
> 		put arrayDecode(encodedPrefs) into prefs
> 		put "The decoded data contains:" && prefs["database"] & return
> 	end if
>
> 	put "data2.db" into preferences["database”]
> 	put arrayEncode(preferences) into encodedPrefs
> 	put arrayDecode(encodedPrefs) into prefs
> 	put "The decoded data contains:" && prefs["database"] & return
>
> This is what the script outputs:
>
> peter$ test/test.lc
> The decoded data contains:
> The decoded data contains: data2.db
> peter$
>
> Any suggestions to what I’m getting wrong or is it a bug?
>
> Regards
>
> Peter
> _______________________________________________
> 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





More information about the use-livecode mailing list