On Jun 8, 2006, at 11:15 AM, John McKernon wrote:

Ah.  For this you should use FolderItem.GetSaveInfo.  To store the
data in a text file, you should encode the data using Base64, which
returns "text".

Would you recommend doing this when storing all strings in a text file?

As I understand it, RB automatically uses UTF8 encoding when writing strings
to text files, does that handle all kinds of unicode text?

Reading/writing text files was so easy back in the days when ASCII was the
only thing around...

Okay, let's distinguish between "strings" and 'text". Here, a "string" is a chunk of binary data. REALbasic String objects can contain anything. "Text" is a string, plus a text encoding that defines how to interpret the bytes.

FolderItem.GetSaveInfo returns a REALbasic string with nil encoding. Thus it is not "text". What EncodeBase64 does is to take binary data and encode it as an ASCII string. There is a Base64 class on my web site if you want to see how it works.

If you have a REALbasic string that is UTF-8 encoded, it is "text". If this text contains linebreaks, then you still need to consider this when writing to and reading from files using TextOutputStream and TextInputStream.

Charles Yeomans
_______________________________________________
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>

Reply via email to