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