binaryEncode question

Jeanne A. E. DeVoto jeanne at runrev.com
Thu May 2 22:52:01 EDT 2002


At 7:47 PM -0700 5/2/2002, Kurt Kaufman wrote:
>When I request the binary for hex "00" like so:
>put binaryEncode("H2","00")
>
>-and put the result into a field,
>I get a non-printable ascii char which then reads "20" in my hex
>editor.  Shouldn't that be "00"? Other entered values appear as
>expected, for instance "4d"  appears as the ascii char "M", which will
>appear again as "4d" in the hex editor.
>Is hex "00" a special case of some sort?

Putting a non-printable character into a field is going to give you
unexpected results in many cases. (If you put the result of the above into
a variable instead, and check the charToNum of that variable, you'll see
that it's being converted to a null.)

If you need to store binary data, the best place is in a custom property.
This is saved with the stack, just like field contents, and you can pull
the data out and display it as needed.

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list