realbasic-nug
[Top] [All Lists]

Re: Editfield and text encoding question

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Editfield and text encoding question
From: Laurent Vidonne <list dot reader at asialogique dot com>
Date: Wed, 31 Aug 2005 23:10:51 +0800
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Organization: Asia Logique Ltd.
References: <43158099 dot 7090806 at asialogique dot com> <a06200722bf3b6ef159e9 at [10 dot 0 dot 1 dot 4]>
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>

<Prev in Thread] Current Thread [Next in Thread>