the mouseText and Unicode

J. Landman Gay jacque at hyperactivesw.com
Sat Jun 18 14:34:47 EDT 2011


On 6/18/11 7:32 AM, Slava Paperno wrote:

> You also said "if you're desperate, delete that extra null byte." That's
> intriguing. I don't care about PPC machines. But I can't find any null bytes
> in my fields. I expected a null byte to be added to each Roman character,
> e.g. 0x00AF. But when I use "put byte N of field X" for the Roman
> characters, I can't find a null byte anywhere. Roman characters seem to be
> represented by one byte in my two-bytes fields. I know this doesn't sound
> right, so I must be missing something.

You aren't missing anything, that's how it works right now. If it's 
ascii, it doesn't get that extra byte. We will all be so happy with real 
unicode gets implemented.

Here is a shudderingly, terrifyingly ugly hack that seems to work, at 
least with the sample text you posted:

on mouseUp
   get word 2 of the mouseCharChunk
   lock messages
   lock screen
   put the unicodeText of me into tOrigText
   replace space with "|" in me
   set the itemdel to "|"
   put the number of items in char 1 to it of me into tWordNum
   set the unicodeText of me to tOrigText
   put word tWordNum of me && tWordNum
   unlock screen
   unlock messages
end mouseUp

If you don't lock messages, it takes forever. There may be a way to 
improve this, but that's the idea.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list