Jump to content

Altered diacritic representation on shell script input?


Recommended Posts

Hello! I'm attempting to set up a workflow that includes passing a unicode character with a diacritic through a shell script. However, the "Run Script" node in the workflow seems to be converting its input to another representation of the characters which cause issues. In particular, the character being passed into the bash script is when the issue seems to be occurring.

 

More specifically, I'm using a workflow that takes the currently selected Japanese text, and does something with it. In this example, the bash script just re-echos the input, and then the text is searched on Jisho.org (a Japanese-English dictionary site). The character `が` demonstrates the issue. The version which is passed through the bash script changes to another representation of `が` which on Jisho.org is searched as a separated `か` and the ` ゙` (dakuten diacritic).

 

I've attached a simplified workflow below which presents my issue. It includes the action I would like to achieve, as well as a couple other example cases showing that the character seems to be changed on input into the bash script (e.g., setting the character within the bash script works as desired, but setting it within one bash script and passing it to another does not).

 

I'm assuming this question has been answered before, but the answers I found with my various search term attempts did not seem to turn up the answer I was looking for. I apologize in advance for the likely repeat. Any suggestions and/or explanations would be appreciated. Thank you for your time!

 

Google Drive link to workflow:

https://drive.google.com/file/d/1YXoz4KWt_4XbTJtrdM4MKJlmSe9rompl/view?usp=sharing

 

Alfred 4.6.3
macOS 12.2.1

Edited by jackwayneright
Link to comment
4 hours ago, jackwayneright said:

I'm assuming this question has been answered before

 

Alfred normalises Unicode to NFD form before passing it to scripts. If you need the raw input as entered by the user, tell Alfred to write it to a text file and read it from there.

Link to comment
3 hours ago, deanishe said:

tell Alfred to write it to a text file and read it from there.


Alternatively, copy the text to the clipboard and read it from there in the Run Script. 
 

Or, and this should be more convenient for this specific use-case, always normalise whatever text is passed-in. That would have the side-effect of fixing cases where the input is decomposed.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...