Jaguar script not working in Panther: Unicode text problem

Hi,
I have a script that formerly worked with Jaguar. As I could find out in Apple’s Releases Notes http://www.apple.com/applescript/releasenotes/192OSX.html there has been a change of the text type returned by display dialog to typeUnicodeText…

Now any variable that I try to get from a dialog box and write to the Notes document does fail with a -10001 error.

Any varaibles defined by

 set varName to "SomeText" 

do work.

How can I use these unicode text together with Lotus Notes?

set ToAddress to "user@domain.com"
set Subject to "Some TEXT"

----- Enter Body Text
set BodyEntry to display dialog "Enter any additonal comments:" buttons     {"Cancel", "OK"} default answer ("Some Text" & return) default button "OK"
set BodyText to the text returned of BodyEntry as string

tell application "Notes"
    set myDB to make new database with data {"", ""}
    try
        openmail myDB
    end try
    
    set myDoc to make new document with data {myDB}
    set rtitem to make new richtextitem with data {myDoc, "Body"}
    
    replaceitemvalue myDoc itemname "SendTo" newvalue ToAddress
    replaceitemvalue myDoc itemname "Subject" newvalue Subject
    
    replaceitemvalue myDoc itemname "Body" newvalue BodyText
    send myDoc without attachform
end tell

Regards, Thomas

The ‘standard’ way of coercing Unicode text to plain text appears to be:

set dialogReply to text returned of (display dialog "Say something" default answer "OK")
class of dialogReply --> Unicode text

set plaintext to class «ktxt» of (dialogReply as record) -- this is the magic
class of plaintext -- now it's a string

Once you have the plaint text version of the text you should be able to use it in your script like you did before.

Ideally, of course, Notes should be updated to handle unicode text, and Apple should provide a more intuitive way of coercing unicode to plain.

:smiley: