Joseph,
Thank you for your reply.
[ ...]
it seems that RB applies the default UTF-8 encoding, which is fine
with me.
I'm not sure that's what it does; I think it guesses the default 8-bit
encoding for your system. But the exact behavior is undefined and you
certainly shouldn't be relying on it.
Well, I'm not. I only meant that that's what the debugger shows me.
What I don't understand is that it seems that the data is somehow
changed : if I now try to decrypt cipherField.Text, I get a checksum
error and garbage.
But of course. It's been converted to text, as well as it can. The
mistake is in asking REALbasic to do so. You should either (a) not
assign this arbitrary binary data to an EditField, or certainly not
expect it to come back the same way, or (b) define a valid encoding
for it (using DefineEncoding).
I have no valid reason to display ciphertext (can't read it anyway ;-),
I only enjoyed seeing how 'indecipherable' it was :-) while fine tuning
this thing so (a) is fine. The purpose of my question was to try and do
justice to 2 assumptions that I now see are (plain) wrong :
- any binary data can be displayed as text, if not meaningful one ;
- displaying binary data might show 'garbage', but the underlying data
would be un-touched.
I guess I formed these assumptions seeing how a text editor (say BBEdit)
can open just about any file, and display 'something' from it, while
seemingly not 'breaking' it.
Now, you've just explained that RB would convert this binary data to
display it.
Is this different ? If so, why / how ?
Thanks again for sharing your expertise,
Laurent Vidonne
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|