Search the Community
Showing results for tags 'unicode characters'.
Found 2 results
I’m struggling to get a script filter to work which outputs a variable containing a mixture of text and emojis. In the output, Alfred just spits out empty characters for the emojis (⍰ question mark in a box). There’s obviously an encoding issue I’m overlooking, and I haven’t been able to quite put my thumb on it. To explain, I’ve created a script filter with AppleScript that’s supposed to let the user select a playlist from their Apple Music library (to play it, move it, etc). I recently moved over from Spotify to Apple Music, and I have a ton of playlists (put that's a separate problem - ha)! And, as you might guess, some of my playlists include emojis. When I run the script filter, Alfred’s output just shows empty characters where the emoji’s used to be. Consider the following example: Playlist: Radiohead ⭐ Faves Script Filter/Alfred Output: Radiohead ⍰ Faves Debug: Radiohead \u2b50 Faves So, while most of this is over my head, from what I understand, my JSON output is being spit out as formatted for C/C++/Java Src (when it should be in the usual utf8 unicode format). Any suggestions for fixing it? I've never tinkered around with JSON.scpt file that does all of the heavy lifting, so hopefully it's just a minor issue with my code. Admittedly, I’ve always been confused about how JSON and AppleScript work together. Although I’ve been able to create script filters in the past thanks to everyone’s help, I’ve never made one that dealt with text that containing emojis. Thanks for any help you can lend! For testing purposes, I’ve uploaded a test workflow here: https://share.getcloudapp.com/xQuDN0dl. And, here's screenshot of its script filter:
My workflow script ends with printing output. That output goes to Alfred's "copy to clipboard". 1. How does Alfred interpret the output it receives? Do I need to escape anything in my output? Perl code: print 'this is a string with special characters in it Đ⌂' The above is a simplified model. What is REALLY happening is the Perl code copies the special characters from the clipboard in the first place, then prints them out. When I look at what the Perl code prints out in the terminal, I can see the special characters just fine. So it seems that it is ALFRED who is unable to accept the special characters or put them into the pasteboard correctly. It replaces them with '?' question marks. 2. I am open to creative solutions. I never intended to copy my output to the clipboard in the first place. I just needed to use the "paste into frontmost application" option. Using an apple script to execute "cmd-V" is an option, but I don't think it will work in all applications. I guess my second, slightly related question is "How does Alfred paste into the frontmost application reliably?" Maybe I can mimic that behavior and bypass Alfred.