On Mar 29, 2008, at 5:30 PM, James Sentman wrote:
> I guess it's mostly because of my recent bad experiences with it ;) Un
> leopard Apple forced all strings in AppleScripts to UTF16 and I use
> RB's default of UTF8, and RB doesn't know that the strings now coming
> from AppleEvents are no longer binary equivalent so for example I
> can't look up objects in a dictionary by name to resolve an apple
> script object request anymore.
OK, I see your point there. Dictionaries are the one place where
strings of different encodings are not functionally equivalent.
Unfortunately, that would be hard to fix... but I could see an
argument for a "ForceEncoding" flag on them that would automatically
convert all strings stuffed into (or looked up) a particular
Dictionary, to help deal with cases like this.
> And I've found cases where some encodings seem to cause random crashes
> when putting things into CFObjects...
I haven't heard of that, but CFObject isn't on RB type, so I guess
this would fall into the incorrectly-coded-declare category. Not
much RB can do about that.
> lots of little things like that where I find
> I have to deal with it when I shouldn't. If you're just using RB
> inside RB then it rarely becoms an issue, but when you talk to other
> things then all of a sudden things dont always work and sorting it out
> is not always obvious.
True enough.
>> Right, but the proper way to avoid that problem is to quite using
>> Read/WritePString.
>
> But... if I just use write/read it still doesn't save that does it?
> It's a binary stream and if you use that you have to deal with
> resetting the encoding.
Well yes, but BinaryStream.Read has an (optional) Encoding parameter
you can use to specify the encoding right away, unlike ReadPString.
> Is there anything wrong with PStrings except
> that they dont preserve encoding?
Yes, there's the fact that they don't give you a way to specify the
encoding in the read operation, and that they break if you try to
store a string more than 255 bytes, and that they imply (though don't
force) a WorldScript encoding.
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>
|