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 Huber <joehuber at talasoft dot com>
Date: Mon, 31 Mar 2008 07:52:06 -0700
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> <A652AB13-FCF7-4D95-B6B1-5EC6EC3E84DE at inspiringapps dot com> <3E14F3DA-1A0F-47A7-A23A-5561C8EFDFC3 at rbclass dot com> <A0720DC7-6E68-4825-B1E7-06FA772B07E7 at inspiringapps dot com> <A08DAFF0-4131-4C31-BE88-965126CC576F at rbclass dot com> <09004169-C758-401C-BF6E-6FB615336097 at rbclass dot com> <1BD9DBC6-83AA-42FF-912E-010229927261 at sentman dot com> <6D8444CF-8F0F-4A8A-8117-B4C6E4EEE06C at rbclass dot com> <2061F18F-62B0-4CDB-BCAC-6EE65F613122 at inspiringapps dot com> <2F88C8F7-913B-48BB-A96F-D9932B096431 at mac dot com> <FFA6285E-CDAF-4FFA-A755-D5A8EA38BAD1 at inspiringapps dot com> <3C40E8C0-AC78-4BBC-86B2-81CD96ACCA7E at mac dot com>
At 4:27 PM +0200 3/31/08, Arnaud Nicolet wrote:
>Why not WritePStringWithEncoding and ReadPStringWithEncoding that 
>writes/reads like a PString with, additionally, a byte for the encoding?

There's really no point in modifying PString for this. But it would 
make perfect sense to create a couple of methods to Extend the 
BinaryStream class that read and write strings, including their text 
encoding. Maybe call it an ANstring. It could have a 16 bit length, 
followed by the text encoding followed by the string data. Of course 
they would only work with files to and from your own programs that 
understand ANStrings. But they would support larger strings than a 
hacked Pstring could.

But it would be better to not bother creating a new and incompatible 
string format and just always convert your strings to UTF8 on output. 
That way you can correctly assume they are UTF8 on input, and other 
programs are likely to handle them correctly, vs an ANstring that no 
other programs would recognize.

IMHO Universal UTF8 is the best approach...

Regards,
Joe Huber
_______________________________________________
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>