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>
|