cross-platform compress & decompress

Dave Cragg dcragg at lacscentre.co.uk
Mon Dec 1 18:59:08 EST 2003


At 3:27 pm -0800 1/12/03, Richard Gaskin wrote:

>>  On Dec 1, 2003, at 4:19 PM, Mark Brownell wrote:
>>
>>>  I've read everything I can find in the archives and I'm wondering if
>>>  anyone has solved the cross-platform compress & decompress problems. I
>>>  would like to create a compressed text file on Mac X and open &
>>>  decompress it on Windows, the same goes for make on Windows & open on
>>>  Mac. I'm not sure but it looks like the different charSets for each OS
>>>  seems to be the problem. Anyway when I try to open made on Mac in
>>>  Windows the file is not recognized as being compressed. I've tried
>>>  stripping the header before decompressing with no luck. Perhaps a
>>>  cross-platform compress/decompress is in the works soon? I solved
>>>  these charSet OS issues in cross-platform encryption by converting to
>>>  numbers within the entire encryption/decryption process. This took the
>>>  relative positions of the different chars in charSets out of picture
>>>  until the final rendering takes place.

Are you treating the files as binary data and not as text files? That 
is, when you save and open, you should use "binfile" and not "file". 
For example:

When saving:
   put compress(field 1) into url ("binfile:" & <someFile>)

When opening:
   put decompress(url ("binfile:" & <somefile>)) into field 1

>
>I don't think it's a bug as much as a very useful feature with unintended
>consequences for binary data:  in old versions of the engine, folks
>complained that data stored in user properties did not have the automatic
>cross-platform conversion as text in fields enjoy.  So several versions ago
>this was changed to allow the same for user props.


Are you sure that's true, Richard? I use custom props for image data, 
audio, and a host of other binary data but haven't noticed any cross 
platform issues.

Dave


More information about the use-livecode mailing list