Problem with arrayDecode
Peter W A Wood
peterwawood at gmail.com
Sun Jul 5 04:46:36 EDT 2015
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
More information about the use-livecode
mailing list