the mouseText and Unicode

Slava Paperno slava.paperno at cornell.edu
Fri Jun 17 23:07:47 CDT 2011


Hi, List! It's me again with my Unicode problems in bilingual fields. I just
spent four hours on this problem and gave up.

I'm trying to retrieve the text of the word the user clicked on in a locked
field. As far as I can tell, the MouseChunk and the mouseText are useless
with Unicode, and especially with a mixed Unicode and Roman text.

I tried using the mouseCharChunk, and then to decrement the char position
until I hit a word delimiter and to increment the char position until I hit
a word delimiter, but the problem is that a Roman character (including
punctuation) is one byte long while a non-Roman character is two bytes, and
I cannot interpret the two positions that the mouseCharChunk returns unless
I know which characters in the field are Roman, and which are non-Roman--and
of course I can't know that.

Is there an equivalent to the mouseText, or the mouseChunk, or the
mouseCharChunk that is Unicode-aware? Or some ingenious way to retrieve the
word that the user clicked?

I see a similar problem coming up when I start using hyperlinks in bilingual
texts: retrieving the text of a chunk whose textStyle is set to "link"
involves a very similar issue.

Slava





More information about the use-livecode mailing list