1

This AppleScript creates a new email in my default mailer, but the balloon emoji (โ€œ๐ŸŽˆโ€) in the subject is converted to the question mark character (โ€œ?โ€).

set theURL to "mailto:<[email protected]>?&subject=Happy Birthday ๐ŸŽˆ&body=Wile:

beep beep.

- Road Runner"
open location theURL

How do I open a URL that contains an emoji using AppleScript?

0

1 Answer 1

1

Apparently there is no simple way to encode Emoji in AppleScript itself; alternatives include using:

  • ASObjC
  • Shell command to Perl, Python (somewhat more involved since Apple no longer installs Python with macOS), etc.
  • JXA

I settled on the percent encode handler within Shane Stanleyโ€™s RegexAndStuffLib v1.0.7

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use script "RegexAndStuffLib" version "1.0.7"
set newline to (ASCII character 13) & (ASCII character 10)
set blankline to newline & newline
set theRecipient to percent encode "Wile.E.Coyote<[email protected]>"
set theSubject to percent encode "Happy Birthday ๐ŸŽˆ"
set theBody to percent encode "Wile:" & blankline & "beep beep." & blankline & "- Road Runner"
set theURL to "mailto:" & theRecipient & "?subject=" & theSubject & "&body=" & theBody
open location theURL
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .