On 15-Apr-07, at 2:12 PM, Joe Huber wrote:
> At 11:31 AM -0700 4/15/07, Lennox Jacob wrote:
>> Kindly advise.
>
> An editfield may not give you back exactly the same bytes that you
> put in, and that is especially true if it contains binary data as it
> would after being translated by XOR.
>
> Try a simpler test like this...
>
>
> s = EncodeDecode(EditField1.text)
>
> EditField2.text = EncodeDecode(s)
>
> And even that might not show you what you expect if the original text
> used anything but ASCII encoding, since the text encoding would get
> lost in the XOR process. Doing XOR twice gets you the same bytes back
> but you'd still have to set the text encoding if that was important
> to you.
Something like ( I have 3 edit fields on one window and this is in
the action event of a push button)
EncodeDecode just does something simple or can be as sophisticated as
you want
dim s as string
dim tmp as string
dim base as integer
dim variant as integer
dim format as integer
dim t as TextEncoding
t = EditField1.Text.Encoding
s = hex(EditField1.Text.Encoding.base) + "|" + hex
(EditField1.Text.Encoding.variant) + "|" + hex
(EditField1.Text.Encoding.format) + "]"
s = s + EditField1.text
s = EncodeDecode(s)
editfield2.text = s
s = EncodeDecode(s)
base = val("&h" + nthField(nthfield(s,"]",1),"|",1))
variant = val("&h" + nthField(nthfield(s,"]",1),"|",2))
format = val("&h" + nthField(nthfield(s,"]",1),"|",3))
s = nthfield(s,"]",2)
t = GetTextEncoding(base, variant, format)
s = DefineEncoding(s,t)
editfield3.text = s
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>