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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to