byteLen()?

Richard Gaskin ambassador at fourthworld.com
Thu Mar 9 19:06:22 CET 2017


Mark Waddingham wrote:

 > On 9 Mar 2017, at 02:37, Richard Gaskin wrote:
 >>
 >> the len() function returns a character count, but with Unicode this
 >> may be very different than the byte size.
 >>
 >> Do we have a size() or byteLen() function?
 >
 >
 > No, there is no such function as the byte length is a property of
 > text which has been encoded with a specific encoding, not text in
 > general.
 >
 > the number of bytes in textEncode(tText, kEncoding)
 >
 > Should give you what you need.

Thanks. I don't mind the verbosity, but I could use some clarity:

There's been talk of LC using UTF-16 internally, but when I do this:

on mouseUp
    put "Hello" into s
    put the number of bytes of s
end mouseUp

...I get "5".

When does LC use UTF-16, and when it's not UTF-16 is it still ISO-8959-1 
or UTF-8?

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com



More information about the use-livecode mailing list