the mouseText and Unicode

Richmond Mathewson richmondmathewson at gmail.com
Sat Jun 18 05:16:31 EDT 2011


On 06/18/2011 09:07 AM, Slava Paperno wrote:
> Aha! The idea of using "the number of words" is brilliant.
>
> Unfortunately, the word boundaries don't "quite" work, and I think it's for
> the same reason: I think the mouseCharChunk reports bytes, not characters.
> It is Unicode-smart in some ways: when you click a non-Roman letter, it
> returns "char N to N+1 of field X." When you click a Roman letter in a
> double-byte field it returns "char N to N of field X."

I think you may be right about double-byte stuff; or that Livecode looks
for things encoded in the ASCII set, and treats everything "else" as space.

However (not having any Russian I have used Bulgarian) I set up a stack 
just now with
2 flds: "fSTART" and "fEND" and typed 'Всичко е глупости или лайно.' 
into fld "fSTART"

I then typed this into a button:

on mouseUp
   set the useUnicode to true
   set the unicodeText of fld "fEND" to the unicodeText of word 3 of fld 
"fSTART"
end mouseUp

and ended up with 'глупости' in fld "fEND".

Try it . . .  :)

Love, Richmond.





More information about the Use-livecode mailing list