Sending Unicode to "do AppleScript"

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

Example:
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:
?w???v

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

Thanks!

Pv

Comments

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

    http://www.redstonesoftware.com/phpBB2/viewtopic.php?t=567&highlight=unicode

    If you find some other means please post it in the Redstone Software User Forums for us all to benefit.
  • SenseTalkDougSenseTalkDoug admin ForumAdmin admin
    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.
Sign In or Register to comment.