On Mar 31, 2008, at 6:38 AM, Arnaud Nicolet wrote:
> I'm thinking of a feature request for RB but I don't know if it's
> technically possible:
>
> On each write of PStrings, RB automatically inserts the encoding of
> the string (e.g as an integer), in a way that does not disturb how
> PStrings work (e.g, after the PString).
> On read of a PString, RB automatically reads the PString and then the
> encoding, which it uses to convert the read PString.
That's not possible, in the sense that such a function would no
longer be WritePString/ReadPString. The point of those functions is
to interface with files commonly used under Mac OS 9, where "PString"
has a very specific definition (length byte followed by up to 255
bytes of data in a WorldScript encoding). If you write anything
else, then you're no longer adhering to the definition, thus
rendering the function pretty pointless.
> As far as I know, we can't do this programatically: we can't know the
> "name" or "value" of the encoding of <this particular> string and we
> can't either convert back something to an encoding.
Sure you can: string.Encoding gives you exactly that.
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>
|