Sending Unicode to "do AppleScript"

Basic question:
How can I pass Unicode characters to an AppleScript command called by SenseTalk?


set txtUnicode to "ヘルプ"
set txtScript to merge of {{
return "[[ txtUnicode ]]"
set result to doAppleScript(txtScript)
put result

It returns a munged version of the text:


Any ideas how to get this to work?
It is seriously causing some major blocking issues in my automation.



I’m not sure of the specifics of your needs, however I have posted a UNICODE conversion routine in SenseTalk to the forums:

If you find some other means please post it in the Redstone Software User Forums for us all to benefit.

AppleScript’s support for Unicode seems to be somewhat limited. Here’s one approach that seems to work, passing the Unicode text via a file:

set txtUnicode to "???"
put txtUnicode into file "/tmp/UnicodeToAppleScript"

set txtScript to merge of {{
set f to a reference to posix file "/tmp/UnicodeToAppleScript"
open for access f
set s to read f as ?class utf8?
close access f
display dialog s
return s

set result to doAppleScript(txtScript)
put result

Hopefully that will work for you. If not, there may be other options we can explore.