At 10:06 PM +0100 2/11/06, Thomas Tempelmann wrote:
> >BTW, in your posted code - since you use MidB - doesn't that
>create a nil encoded string?
No, it returns a string with exactly the same encoding as the source.
Ah, thanks.
You're welcome. I should have pointed out the general principle: RB
never discards encoding information when it can avoid it. ChrB()
returns a nil-encoded string, for example, because it has no way to
guess what encoding is wanted (indeed, there's no reason to suppose
ChrB would be used for text at all). But LeftB, MidB, etc., are all
working on a string with some encoding; just because they're
measuring by bytes rather than by characters is no reason for them to
throw this information away.
Stuffing a string into a MemoryBlock or file, though, does require
the encoding to be stripped, since there's simply no place to put it
(without changing what it means to write a string). So those are
cases where you may need to DefineEncoding when you get the string
back out.
Anyway, I hope this helps set the expectation of how RB handles
encodings, so in the future you (all) can guess more accurately about
what's going on. (And of course, when unsure of your guess, one
would hope that you could go to the LR for any string function and
find an explicit statement about what the encoding of the resulting
string will be. That's probably not the case now, but maybe it will
be in the future.)
Best,
- Joe
--
Joseph J. Strout
[EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>