Going Mad With Unicode
Igor Couto
igor at pixelmedia.com.au
Tue May 27 22:41:01 EDT 2003
Friend Revolutionaries,
I have been trying to copy (via script) the contents of a field into a
specific line in another field. The problem I'm experiencing is that
the text contains roman-extended characters (Esperanto characters: ,
, , , and ), and even though I've tried everything I can think
of, using the 'unicodeText' and the 'htmlText' properties, I still
cannot make it work. I am using RunRev 2.0, with MacOS X 10.2.6.
To reproduce what I am experiencing, try the following:
1) Make a new stack, and place 2 fields in it - let's call them
"sourceFld" and "targetFld". The source field can be just one line
high, while the target field should be several lines high. Type
something into the target field (it doesn't matter what) - for a few
lines.
2) In the source field, type some text using the 'US Extended' keyboard
layout. To type some of these Esperanto characters, for instance, while
using the 'US Extended' keyboard, press "option+6" (to activate the
circumflex accent) and then either 'c', 's', 'g', 'j' or 'h'.
3) NOW: using the message box, try creating a script that copies the
contents of "sourceFld" into a line (let's say, line 2) of "targetFld".
The extended characters either disappear or change... Here is what I've
already tried:
1) put field "sourceFld" into line 2 of field "targetFld"
RESULT: the extended characters appear in the targetFld as 'unknown
character' boxes.
2) put the unicodeText of field "sourceFld" into line 2 of field
"targetFld"
RESULT: exactly the same as above - the extended characters appear as
blank boxes.
3) set the htmlText of line 2 of field "targetFld" to the htmlText of
field "sourceFld"
RESULT: the characters disappear. If I check the 'htmlText' property of
line 2 of the target field, I can see that it actually does NOT contain
the same characters as the source field (compare with the htmlText
property of the source field!).
4) set the unicodeText of line 2 of field "targetFld" to the
unicodeText of field "sourceFld"
RESULT: an error - I believe the ' unicodeText' is not a property that
can be 'set' on a 'per line' basis. It only seems to work if you set
the entire field!
What seems to happen is that Revolution IS COPYING the right values out
of the source field. If I 'split' the script, and get Rev to put the
htmlText of the source field into a variable, and then check the
contents of the variable, it actually DOES contain the right characters:
put the htmlText of field "sourceFld" into myVar
put myVar
The contents of 'myVar' are IDENTICAL to the contents of the htmlText
of field "sourceFld".
However, if we now say:
set the htmlText of line 2 of field "targetFld" to myVar
We see that Revolution is somehow changing the values of the extended
characters...
Does anyone know how to get around this?
I'm sure that there must be a solution, as I understand Revolution has
quite a few Japanese users, and they must be able to deal with this
somehow!
Any suggestions would be greatly appreciated!
Many thanks,
--
Igor de Oliveira Couto
----------------------------------
igor at pixelmedia.com.au
----------------------------------
More information about the use-livecode
mailing list