Page 1 of 1

PeekS with Flag #PB_ByteLength

Posted: Thu Apr 20, 2017 11:20 am
by Josh
Help wrote:#PB_ByteLength:
only valid when using the #PB_UTF8 flag, the 'Length' will represent bytes (not characters).
Would be nice, if this could be changed, that the Flag #PB_ByteLength is simply ignored, if the format is not Utf8.

Background: Copying file-text to memory an then using PeekS, I can use the BOM as flag. At the moment I have to make an additional check to see if I can use #PB_ByteLength or not.

Re: PeekS with Flag #PB_ByteLength

Posted: Thu Apr 20, 2017 12:26 pm
by mk-soft
Is not Unicode you can use PeekS with type #PB_Ascii...

Re: PeekS with Flag #PB_ByteLength

Posted: Thu Apr 20, 2017 1:53 pm
by kenmo
Why request that #PB_ByteLength is ignored for ASCII and Unicode?

Better, let's request that #PB_ByteLength is implemented for ASCII and Unicode.

Should be simple...
numAsciiChars = numAsciiBytes
numUnicodeChars = numUnicodeBytes/2 (by PB's definition of characters)