[ANN] libJson

Mark Smith lists at futilism.com
Wed Jan 7 17:20:11 EST 2009


On reason that you might have had trouble base64encoding is that it  
inserts a newline every 80th (I think) byte, so you only need that to  
happen once to mess up a scheme that relies on line delimiters. In  
fact, you can remove the newlines that it inserts, and it doesn't  
seem to cause problems with base64decode...

Best,

Mark

On 7 Jan 2009, at 22:13, David Bovill wrote:

> This was just a quick hack - but it did seem to have worked for a  
> while ( i
> used it for putting arrays inside arrays and storing them as text  
> files -
> started with XML and then thought the better of it :), but I'm sure  
> there
> are loads of things it doesn't work with unicode?, certainly not  
> the new
> multidimensional arrays...
>
> I'm posting it more to find out a bit more about why the urlEncode  
> seemed to
> work where all else failed :)
>
> function array_Marshal someArray
>     put keys(someArray) into someKeys
>     put empty into baseTable
>     repeat for each line someKey in someKeys
>         put someArray[someKey] into someValue
>         put urlencode(someValue) into encodedData
>         -- put base64Encode(someValue) into encodedData
>         -- replace return with empty in encodedData
>         put someKey & tab & encodedData & return after baseTable
>     end repeat
>     delete last char of baseTable
>     return baseTable
> end array_Marshal
>
> function array_UnMarshal baseTable
>     set the itemdelimiter to tab
>     repeat for each line someLine in baseTable
>         put item 1 of someLine into someKey
>         put item 2 of someLine into encodedData
>         put urldecode(encodedData) into someValue
>         -- put base64Decode(encodedData) into someValue
>         put someValue into someArray[someKey]
>     end repeat
>     return someArray
> end array_UnMarshal
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list