Unicode Text

I am having some what difficulties trying to move some data from my “Mail” application.


tell application "Mail"
    set myData to content of message X of mailbox "INBOX" of account "Me" as string
end tell

The string is coming out in unicode or rtf. How do I just recieve just the text?

Steve :shock:

Please if anyone knows how to change unicode text or rich text format to plain text thru applescript would be appreciated. I know I have banged my head enough on one side… hate to see the other side of my head just as banged up… :slight_smile:

I had the same issue and never came up with a “good” solution. I can find no way to coerce styled text into text. My eventual solution was to create a copy of the string one character at a time by converting each character to its ASCII equivalent and back again and appending it to the new string. That is the only way I found to remove the styling. (I will try to post code later tonight.)

If anyone has something better, please let me know.

Does this provide relief?

tell application "Mail"
    set myData to content of message X of mailbox "INBOX" of account "Me" as string
end tell

if class of myData is Unicode text then set myData to «class ktxt» of (myData as record)

hey, rob! snippety snippet! :wink:
(just found “snippety” in my dictionary. expect this means what dictionary-developer thinks it does mean :rolleyes: )

I hope it works but I can only take credit for reading and saving it. It’s someone else’s snippety snippet that I saved for a rainy day. :wink:

Rob,

You are now my God for saving me mind from blowing up. Thanks for collecting that snippit! Thanks it works great!