the mouseText and Unicode: the Russian letter R
BNig
niggemann at uni-wh.de
Sat Jun 18 18:12:26 EDT 2011
Slava,
although Роберт is a nice guy he must give in:
I tried with
Саша, Наташа, Митя, Роберт, Robert, Jeffrey, and Соня Петрова, СССР, ССРРСС
Слава
Паперно, Лора Баглай, Макс, Паперно
Роберт, СССР, ССРРСС
-------------------
on mouseUp
get word 4 of the clickCharChunk
put it into tSelPos
put 0 into tStartSel
repeat with i = tSelPos down to 1
put the htmlText of char i of field 1 into tHTML
if (tHTML contains "<p> <" or tHTML is "<p></p>" or tHTML contains
">,<") then
put i into tStartSel
exit repeat
end if
end repeat
put the number of chars of field 1 into tEndSel
repeat with i = tSelPos to the number of chars of field 1
put the htmlText of char i of field 1 into tHTML
put char i of tData into taChar
if (tHTML contains "<p> <" or tHTML is "<p></p>" or tHTML contains
">,<") then
put i into tEndSel
exit repeat
end if
end repeat
select char tStartSel + 1 to tEndSel -1 of me
put the htmlText of the selectedtext into tWordClicked
-- put tWordClicked into field 3
set the htmlText of field 2 to tWordClicked
end mouseUp
-------------------
please watch out for linebreaks
selecting a word of either the unicode kind or the roman kind works with
above code.
I now test the htmlText for space, return and comma. I scan from the
clickCharChunk up and down until any of these are true. Then I exit the scan
and 'declare' what is between a word, select the word in the field and get
the html of the selectedText.
Should also work with the unicodeText of the selectedText instead of the
htmlText I am using now.
If I look at the chartoNum of Р (russian R) I see it is made of ascii 32 and
ascii 9. ASCII 32 being a space maybe that is a clue to why it throws
Livecode off. I would consider this a, well, anomaly and can only hope for
Livecode to eventually support Unicode more completely.
you said "Curiouser and curiouser..."
I would say "uglier and uglier..."
Kind regards
Bernd
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/the-mouseText-and-Unicode-tp3607206p3608391.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list