0

I have a field "data" with Unicode text in it which displays properly. I want to copy a chunk of it and put it into another field called "someData".

I tried the following script in a button

on mouseUp
  put word 2 of line 1 of the unicodeText of field "data" into t
  set the unicodeText of field "someData" to t
end mouseUp

Non Unicode text displays fine in the field "someData" but Unicode text does not.

z--
  • 2,186
  • 17
  • 33

4 Answers4

1

You could probably get away with UTF8 encoding then parsing then re-encoding

on mouseUp
    put word 2 of line 1 of uniDecode(the unicodeText of field "data","UTF8") into t
    set the unicodeText of field "someData" to uniEncode(t,"UTF8")
end mouseUp
z--
  • 2,186
  • 17
  • 33
Monte Goulding
  • 2,380
  • 1
  • 21
  • 25
1
on mouseUp
   put unicode the unicodeText of word 2 of field "data" into field "someData"
end mouseUp

should work.

Marek

0

I am no expert in unicode, but there may be a clue in that LC treats most unicode stuff as properties. Because of this, one may set, say, the uniCodeText of a field:

set the unicodeText of fld 1 to "U+400"

But one cannot set that property, or any property, in a variable. Consider the following two handlers. It is assumed there exist two fields, "fld 1" and "fld 2".

on mouseUp
   set the useUnicode to "true"
   set the unicodeText of fld 1 to "U+400" -- an example
   set the unicodeText of fld "f2" to the uniCodeText of fld 1
end mouseUp

on mouseUp
   set the useUnicode to "true"
   set the unicodeText of fld 1 to "U+400"
   put fld 1 into temp
   set the unicodeText of fld "f2" to temp
end mouseUp

The first works, the second does not. In your example, you try to put displayed uniCode into a variable. I don't think you can "put" that sort of thing. You have to set a property.

Now that said, check out the "put uniCode" command. This might get around the property thing. Write back if it does.

Craig Newman

z--
  • 2,186
  • 17
  • 33
dunbarx
  • 146
  • 2
0

Here is another one-liner you can test:

set the unicodeText of field 2 to the unicodeText of word 2 of field 1
hliljegren
  • 426
  • 3
  • 9