Problem with Unicode

Devin Asay devin_asay at byu.edu
Mon May 8 11:38:32 EDT 2006


On May 6, 2006, at 3:29 PM, RH wrote:
> I want to build a language learning software that uses various  
> methods and a
> lot of multimedia to teach Russian language. Unicode support is  
> needed. I
> found that entering Cyrillic language into field 1 is possible. But  
> to set
> another field with exactly the same properties will distort  
> characters after
> the first space.
>
>
>
> Field "Russian 1": "Как дела" (how are you?)
>
> Field "Russian 2": "Как????"
>
>
>
> on mouseUp
>
>   set the useUnicode to true
>
>   set the unicodeText of field "Russian2" to field "Russian1" -  
> only first
> word is moved correctly
>
> end mouseUp
>
>
>
> Setting a field to ASCII using a Cyrillic font does not work either  
> because
> a field crashes on such settings. For example field "Russian" is  
> set to font
> "Arial CYR" and trying to enter Cyrillic will lead to very strange  
> behaviour
> of text entry, cursor bouncing, etc.

Roland,
I feel your pain. However, you can get it to work. I've been working  
on a very similar project with Cyrillic, and have solved most of the  
problems you're encountering, both in Mac OS X and Windows. I haven't  
seen this specific problem, but have seen similar ones. The biggest  
problem is that characters that fall into the ASCII range, like space  
(ascii 32), comma (44), period (46) are not encoded as unicode, but  
remain ascii. To see what I mean type some Cyrillic text into your  
field and enter this in the message box:

put the htmlText of fld "Russian 1"

You'll see that all of the Cyrillic characters are rendered as  
Unicode entities in the htmltext, but the ascii-range characters are  
simply rendered as the character glyphs themselves, and are enclosed  
by a different font tag. One approach is to convert all the ascii  
characters to unicode, like this:

replace space with uniencode(space,"w") in fld "russian 1"

It can help in some cases but can also get messy.

You can also try setting the htmlText of fld 2 to the htmlText of fld  
1. Generally speaking, unicode "travels" better as unicode entities  
imbedded in html than as straight unicode.

You might try looking at my site at revolution.byu.edu. Go to the  
Tutorials by Topic link and look for Revolution and Unicode. There  
are some notes there about using unicode, as well as some links at  
the bottom to some example stacks. You'll have to open those from  
within Rev, of course, by entering in the message box:

go stack url "http://revolution.byu.edu/unicode/unicodeTrials.rev"

HTH

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list