realbasic-nug
[Top] [All Lists]

Re: WritePString weirdness...

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: WritePString weirdness...
From: Joe Strout <joe at inspiringapps dot com>
Date: Fri, 28 Mar 2008 13:27:40 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <226027DE-9E67-4701-90AD-12E8F3383CF6 at rbclass dot com>
On Mar 28, 2008, at 11:56 AM, Mark O'Neill wrote:

> If I use the following to write string to my preferences file:
>
> stream.WritePString(MyStringToStore)

I don't recommend that.  PStrings are an old Mac OS 9 thing; they  
aren't particularly encoding-savvy, and of course they don't support  
strings greater than 255 bytes (that's bytes, not characters).

The problem you're seeing is no doubt that ReadPString, being a  
legacy function only intended for reading old Mac OS 9 files (which  
used WorldScript rather than Unicode), has not properly defined the  
encoding of the string.  You could correct this with DefineEncoding,  
but I recommend you quit using PStrings for your own data entirely.

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com



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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


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