At 5:35 pm -0700 21/3/02, Dar Scott wrote:

>Concerning "binary data, not text"...  Well, I had assumed that 
>Revolution strings were simply sequences of bytes.  Character 
>strings were those with a character interpretation.  Binary data 
>were simply strings of which the bytes might be any value from 0 to 
>255.

That's my understanding too. The problem I guess is what should a 
field do with values that have no character representation. I've seen 
word processors handle this in different ways. Some display "dummy" 
characters for "bad" values; others simply crash. :) I've never had 
Rev crash with binary data in a field. But it seems to affect the way 
certain functions/properties behave (length for example).

I don't think we should hold any expectations about how a field 
displays or handles non-text data, in the same way I  wouldn't like 
to predict the results of putting text into an image  object.

But if you need to "see" the binary data, you can convert it to 
something more friendly before putting it into a field. For example, 
the following displays the imageData of an image in a list of comma 
separated values, 4 numbers (1 pixel) per line.

on mouseUp
   put the imageData of image 1 into tData
   put 0 into tCount
   repeat for each char tChar in tData
     add 1 to tCount
     put charToNum(tChar) after tString
     if tCount = 4 then
       put tString & cr after tDisplayText
       put empty into tString
       put 0 into tCount
     else
       put comma after tString
     end if
   end repeat
   put tDisplayText into field 1
end mouseUp

The binaryDecode and binaryEncode functions may give better options, 
but I tend to get a headache when trying to figure them out. :)

Cheers
Dave Cragg
_______________________________________________
improve-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/improve-revolution

Reply via email to