On Mar 29, 2008, at 11:10 AM, James Sentman wrote:
> I"m sure Joe is correct when he suggests you're hitting a text
> encoding issue. I understand and even acknowledge the necessity of
> text encoding, but despise is not too strong a word for how I feel
> towards the implementation we're using.
Why's that? In most cases you don't have to worry about it in RB;
the defaults do sensible things and everything just works, except of
course when interacting with some external data source that's not
Unicode-savvy. On the whole, I think it's pretty elegant.
> However, once you read it in from ReadPString it doesn't
> know that anymore as the encodings aren't saved along with the binary
> data.
As they shouldn't be, since the point of WritePString and ReadPString
is to interact with old MacOS9 systems, which didn't store encoding
data nor use Unicode, but generally assumed that all strings were in
the default WorldScript encoding.
> So, regardless of how you write the string, you may have to redefine
> the encoding when you read it back in.
No, if you use a TextInputStream, the encoding will be (correctly)
defined as UTF-8 by default.
> To solve it across the board I believe that you can set the encoding
> that is the default for the binary stream? And even if you do that I"m
> not sure that readPString will honor that because as Joe says it's an
> old call that was never text encoding savvy.
Right, but the proper way to avoid that problem is to quite using
Read/WritePString.
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>
|