gettingstarted
[Top] [All Lists]

Re: Option Characters to binary

To: "Getting Started" <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Option Characters to binary
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Sun, 23 Nov 2003 09:33:20 -0600
References: <200311220603 dot 1anymD1Xy3NZFjX0 at robin> <3FC022DC dot 2010205 at ix dot netcom dot com>
At 10:00 PM -0500 11/22/03, Peter Gatti wrote:

Change that Len to LenB and all will be fine.

But Joe, I used Len() because the Language Reference states that the integer parameter for the read method is 'reads count characters,' so that's what I used.

The documentation is wrong; the parameter is bytes (it would be quite impractical for it to read a certain number of characters). Please file a bug against the documentation.

Ah, I think this is the real reason for my problem. I didn't include the Encoding parameter because I really don't understand what it is or why there is even a need for it. In my mind every character in an edit field has an ASCII number and that's what is being save to a file.

Ah, but of course that's not really the case; there are only 127 ASCII numbers and they don't include any of what you're calling "option characters." I'll post my text encoding FAQ, which should clear things up even further.

And when I read back the file, I don't expect extra characters thrown in that presumably defines the following character as being an option key character... as in the example I gave, '¬©' where the added character ¬ presumably says something about the © character in my text.

No, that's not what's going on at all. The bytes being read back in are exactly what were written out. But RB is not interpreting them as text correctly, because you haven't defined how to interpret these bytes as text (i.e., you haven defined the text encoding).

To be quite frank, explanations and examples in the Language Reference for Encoding are at a level way over my head and seem geared for those who already understand the jargon and how to apply it. I haven't the foggiest idea what to put in that parameter.

Well, for now I would suggest you simply put Encodings.UTF8, which will be correct as long as the data you wrote out came from an EditField and you didn't do any conversions on it.

Best,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'

- - -
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

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