krokofant Posted March 8, 2016 Share Posted March 8, 2016 I hit backspace after I wrote this post the last time and I lost all i wrote... Test #1 (From Terminal) osascript -l JavaScript -e "console.log(escape('ä'))" Notice that the ä is encoded as %E4. Test #2 Create a keyword trigger with a parameter. Let's call this atest. Create an action with osascript (JS) with the following code console.log(escape("{query}")); Connect the trigger and action. Watch the debug console for output. Notice that the ä is encoded as a%u0308. Problem scenario I'm using this NodeJS workflow as a base https://github.com/giangvo/alfred-workflow-nodejs/ I've created an issue about this over there too https://github.com/giangvo/alfred-workflow-nodejs/issues/6 The workflow supports autocomplete with a menusystem. I'm getting external menu entries which contains the letter ä I'm autocompleting a menu entry which places the (%E4 based ä in the search thingy) I'm sending this to an action which contains the code below function getItemData(itemTitle) { var wfData = Storage.get("wfData"); return wfData ? wfData[itemTitle] : undefined; } This tries to access data where the menu entry title is the key. Originally the key is ä / %E4 which it is in wfData but the autocompleted title is ä / a%u0308 which makes the key not match although they at first sight look the same. Any tip on how to go about this? Latest stable update OSX El Captain Latest Alfred v2.8.2 (432) Link to comment Share on other sites More sharing options...
Andrew Posted March 8, 2016 Share Posted March 8, 2016 Any tip on how to go about this? I suspect this is the issue you are seeing: http://www.alfredforum.com/topic/2015-encoding-issue/ You'll need to re-normalise the UTF-8, which you may be able to do in osascript / JavaScript: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/normalize If not, look at the 4th post down, I've shared a little shell utility which can renormalise UTF-8 on the command line after NSTask has been run. Cheers, Andrew krokofant 1 Link to comment Share on other sites More sharing options...
krokofant Posted March 8, 2016 Author Share Posted March 8, 2016 I suspect this is the issue you are seeing: http://www.alfredforum.com/topic/2015-encoding-issue/ You'll need to re-normalise the UTF-8, which you may be able to do in osascript / JavaScript: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/normalize If not, look at the 4th post down, I've shared a little shell utility which can renormalise UTF-8 on the command line after NSTask has been run. Cheers, Andrew Well this enlightened my day. Thanks for the help and for the awesome app. It's alive! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now