Including unicode in text strings for text fields

I am a newbie, but I cannot believe this is impossible:

I put this code in my AppleScript:

set the contents of text field "Trigram" of box "TrigramBox" of window "Calc" to item gua of {"☵", "☱",
       ... etc.

… into the script editor of Xcode and it looks fine, but after saving it gets converted to:

set the contents of text field "Trigram" of box "TrigramBox" of window "Calc" to item gua of {"?", "?", "?", "?", "", "?", "?", "?", "?"}

:/Obviously, the output in the text field is “?”. I tried stuff I found using stuff like assigning

set myVar to «data utxt2204» as unicode text
    but when running it, AppleScript Studio chokes on it.

Does anybody know how to assign a particular unicode character to a field in Applescript Studio in a proper manner?

:)Thanks

Have you seen this post? Using Unicode-only characters in script strings

Edit: In my test project, this worked fine:

	tell window "main"
		tell text field "name" to set content to «data utxt2635» as Unicode text
		tell text field "album" to set content to «data utxt2631» as Unicode text
		tell text field "artist" to set content to «data utxt2204» as Unicode text
	end tell

Also, look at this in Script Editor:

display dialog «data utxt2635» as Unicode text
--> Displays corrrectly

«data utxt2635» as Unicode text
--> Doesn't display correctly

I tried like in your post:

tell text field "Trigram" to set content to «data utxt2635» as Unicode text

… and AppleScript Studio sent me this on trying to run it:
/Users/Jeffrey/Calc/Calc.applescript:94: Expected expression but found unknown token. (-2741)

The guide says:Expected but found .

It didn’t work; I’m not sure why if it worked for you.

Are your files encoded as Unicode? Try encoding them as Mac OS Roman (or whatever would be appropriate for your system’s primary language).

The script is encoded as UTF-8 Unicode. I attempted to convert it as UTF-16 Unicode, but when I do, though it looks fine, it won’t compile, so the script is UTF-8.

No file is being read or written. I simply want to insert, for example, ☱ (TRIGRAM FOR LAKE) glyph 3306 from the script directly into a text field.

It is interesting that this works in the Script Editor, but generates an error in AppleScript Studio:

display dialog «data utxt2635» as Unicode text

:)Script Editor: displays a dialog box

:(AppleScript Studio: Expected end of line, etc. but found unknown token. (-2741)

I am beginning to think this is a bug.

Try setting the script file in Xcode to Mac OS Roman encoding.

Edit:

The AppleScript compiler doesn’t currently support Unicode, but Unicode is usally the default encoding in Xcode.

Your suggestion to setting the encoding of the script to Mac OS Roman encoding seemed to do the trick. Thank you!